IE11 errors on main.js because of `const` in `for (const ...`
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
Next deployments should work in IE11.
Current Behavior
My Next deployment does not work in IE11.
The error is
SCRIPT1053: Const must be initialized
File: main.s, Line: 1, Column 503674
I looked at that place in main.js
, which has this snippet–
... for(const e of Object.keys(o)) ...
I looked online, and apparently IE11 doesn’t allow const
or let
in for
loops, like for (const var ...
.
I removed all these for (const
and for (let
forms from my code and redeployed, but got the same result. I believe it’s because there are 9 modules in my node_modules
that use the for (const ...
form. I can’t replace these modules.
Is there some way to have next build the code and convert these for (const
and for (let
forms to for (var
or for (...
so I can support IE11?
I am using Typescript, but I don’t think that should make a difference.
Steps to Reproduce (for bugs)
Deploy any code with a for (const
loop in it.
Your Environment
Tech | Version |
---|---|
next | 5.1.0 |
node | 9.8.0 |
browser | IE version 11.0.9600.18860 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
IE11 JS Error const name => function - jquery - Stack Overflow
The (value)=>{} syntax is called 'arrow function'. It is a feature of ecmascript2015 (ES6) , a script language specification.
Read more >Video.js 7 to 8 Migration
Attempting to use Video.js 8 in IE11 will cause errors to be thrown. ... getComponent('Component'); const MyComponent = videojs.extend(Component, ...
Read more >Building a webpack plugin to validate your bundle files for IE11
First, I've created a webpack compiler using Node.js API of webpack. Second, I've used `memfs` as the outputFileSystem because I don't want to...
Read more >Handling common JavaScript problems - MDN Web Docs
Now we'll look at common cross-browser JavaScript problems and how to fix them. This includes information on using browser dev tools to ...
Read more >let, var, and const - Go Make Things
let and const work in all modern browsers, and IE11 and up. They cannot be polyfilled. To push support back further, you would...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kedarguy @tashburn i add babel polyfill to my project and fixed all.
This my setup;
.babelrc
pages/_document.js
next.config.js
npm i --save @babel/polyfill
Going to close based on @oliviertassinari’s comment.
It’d be tremendously helpful if you provide full steps to reproduce when creating issues, otherwise it takes more time than it should to check out particular issues. Thanks 🙏