Replies: 1 comment
-
Please don't duplicate your question here and in Discord, choose one and wait for an answer to don't duplicate help efforts The Discord link is https://discord.com/channels/770287896669978684/1376408046854733885 I'm closing this one in favor of Discord as it already has an answer |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using React Router v7 in its framework mode.
I want to support the same browser compatibility as Vite's minimum target
es2015
:Is there a better way to achieve this?
My current approach:
React Router v7's
Scripts
component depends onTextEncoderStream
, which is only supported in Chrome >= 71 and Safari >= 14.1. I'm trying to polyfill it. Currently, the only way I've found to make this work is by including it via an HTML<script>
tag inroot.tsx
. Importing it at the top ofroot.tsx
orentry.client.tsx
seems to be too late:Additionally, my project uses React Query. I initially thought that polyfills for dependencies outside of React Router could be imported at the top of
entry.client.tsx
. However, after several attempts, I've found that these dependencies also require their polyfills to be included via an HTML<script>
tag or imported at the very top ofroot.tsx
to function correctly:This setup allows my project to run correctly in Chrome 64. However, the polyfills introduced above are also loaded in the latest versions of modern browsers, which is not what I want.
I'm wondering if anyone has a better implementation for this. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions