Closed Andrew-Dyachenko closed 9 months ago
The browser support with Next.js is described here - https://nextjs.org/docs/architecture/supported-browsers Next.js doesn't support IE11 deliberately afaik and if you need to support it, you'd need to add specific polyfills etc., by yourself.
@pawelblaszczyk5 JavaScript Template literals (``) which occur an syntax error in that case can not be fixed with polyfills. It can be fixed with transpilation to ES5 only.
If it so, why does the documentation says that it requires to add polyfills to support IE 11 when it is not true?
@pawelblaszczyk5 JavaScript Template literals (``) which occur an syntax error in that case can not be fixed with polyfills. It can be fixed with transpilation to ES5 only.
If it so, why does the documentation says that it requires to add polyfills to support IE 11 when it is not true?
It requires adding polyfills (because template literals is just tip of the iceberg for ie11), but that’s not the only required step 😄 I agree the documentation here could be clearer but isn’t falsy.
It’d be nice to check whether IE11 support is possible at all with additional steps and add them to examples or something.
@pawelblaszczyk5 JavaScript Template literals (``) which occur an syntax error in that case can not be fixed with polyfills. It can be fixed with transpilation to ES5 only. If it so, why does the documentation says that it requires to add polyfills to support IE 11 when it is not true?
It requires adding polyfills (because template literals is just tip of the iceberg for ie11), but that’s not the only required step 😄 I agree the documentation here could be clearer but isn’t falsy.
It’d be nice to check whether IE11 support is possible at all with additional steps and add them to examples or something.
You're right, this is just the tip of the iceberg, and this is the first syntax error that caused IE 11 to crash. It would be great if it were possible to achieve the desired transpilation using SWC instead of Babel Meanwhile React 18 is still supports IE9+
@pawelblaszczyk5 I have tested the starter page of the Next.js 12.3.4
version with IE 11 and it suddenly works, there are no syntax errors (ES6 code) in the Internet Explorer console right out from the box, Unlike the Next.js 14.0.3
, which is have syntax errors. (which means it has ES6 syntax, which IE 11 only partially understands).
But starting from the Next.js 13, it doesn't work. (tested in 13.5.6
)
"Next.js supports IE11 and all modern browsers (Edge, Firefox, Chrome, Safari, Opera, et al) with no required configuration."
Was this a bad dream?
You can configure browserslist but we can't make guarantees that all code will be passed through it because i.e. node_modules ship modern code nowadays too.
Have a look at these docs: https://nextjs.org/docs/architecture/supported-browsers#browserslist
As pointed out here https://github.com/vercel/next.js/issues/58905#issuecomment-1826394403 the default does not support IE11, it's end-of-life and generally considered to be a big risk to still be using it.
Was this a bad dream?
Nope. IE 10-11 actually is not so bad browser, it has many modern features like CSS grid layouts, and many people in the world may still have old computers and be compelled users of it.
You can configure browserslist but we can't make guarantees that all code will be passed through it because i.e. node_modules ship modern code nowadays too.
Have a look at these docs: https://nextjs.org/docs/architecture/supported-browsers#browserslist
As pointed out here https://github.com/vercel/next.js/issues/58905#issuecomment-1826394403 the default does not support IE11, it's end-of-life and generally considered to be a big risk to still be using it.
I think the Next.js 12.3.4
is the answer for those who are looking for support IE 11. Please note what the output JS code will work at the IE 11 only after npm run build && npm run start
but not after npm run dev
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/Andrew-Dyachenko/nextjs-14.0.3-ie11
To Reproduce
npx create-next-app@14.0.3
npm run build
▲ Next.js 14.0.3
✓ Creating an optimized production build
✓ Compiled successfully ✓ Linting and checking validity of types
✓ Collecting page data
✓ Generating static pages (5/5) ✓ Collecting build traces
✓ Finalizing page optimization
Route (app) Size First Load JS ┌ ○ / 5.33 kB 89.2 kB └ ○ /_not-found 876 B 84.8 kB
○ (Static) prerendered as static content
andrew@MacBook-Pro-Andrey nextjs-14.0.3-ie11 %
Open the project in the http://localhost:3000 link in the Internet Explorer 11. If you are using Windows in VirtualBox, try out the http://10.0.2.2:3000/ link to open it
You will see an syntax error in the Internet Explorer 11 console, which says - IE 11 doesn't know the new Template literals from ES6 JavaScript syntax. For example:
Current vs. Expected behavior
Currently there is at least one syntax error in the IE 11
vs
Expected behavior is like on the screenshot below from Chrome, no errors in the console is expected
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
SWC transpilation
Additional context
I didn't deploy the project yet. Only at the local. It just does not work out of the box for IE 11 due the some parts of ES6 Template literals syntax, which should not be in the final build.
I added the
"browserslist"
to thepackage.json
:And I have also tried the canary version of the Next.js. It did't help: