remix: All client side javascript fails to run on non ES-2020 compliant browsers (PRODUCTION only)
What version of Remix are you using?
1.1.3
Steps to Reproduce
npx create-remix@latest (with typescript, remix app server) remix build (Must be a production build. Development doesn’t have the problem) start
Go to localhost:3000 using a non ES-2020 compliant browser (I’m using Safari 12.5) Check the js console and you will see errors
Expected Behavior
Client side JavaScript should run without syntax errors on browsers that don’t support ES-2020
Actual Behavior
ALL Client side JavaScript fails to run. Safari 12.5 reports Syntax error: Unexpected token ‘?’
It appears that the some of the client bundles contain the nullish coalescing operator (??) which is an ES-2020 feature. ES-2020 is too new. There are still many devices out there that can’t support it such as older iPhones.
Again, this only happens in the PRODUCTION build.
There appear to be three places where this is happening, only one of which I’ve tracked down to source code:
- ScrollRestoration component inside dangerouslySetInnerHTML (this has been reported and fixed already)
- Unknown source. Appears in multiple entry.client-XXXXX.js bundles. Looks like this:
var t=n.checked;return R({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function Po(e,n){var
- Unknown source. Appears in multiple other chunks. Looks like this:
:A)}),L=Math.min(Math.max(b??v.length-1,0),v.length-1),B=e.Action.Pop,O=v[
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 16 (6 by maintainers)
Commits related to this issue
- fix: transform syntax for the borwser the support esmodule, fix #1901 — committed to lili21/remix by lili21 2 years ago
- fix: specify esbuild target, fix #1901 — committed to lili21/remix by lili21 2 years ago
- fix: specify esbuild target, fix #1901 — committed to lili21/remix by lili21 2 years ago
Hey folks, there’s a proposal now for
.browserlistrcsupport if you want to give that an upvote, I think that would help with these issues: https://github.com/remix-run/remix/discussions/4769Hi, I don’t work at Remix. I’ll try to get some eyes on this issue soon tho.