Babel compiled ES5 doesn't work in IE11
See original GitHub issueBabel compiled ES5 doesn’t work in IE11
Current Behavior I compiled my ES6 code with babel and Webpack and it doesn’t work in Internet Explorer browser.
Input Code http://iml.ru/new-widget
And I receive such Error in console:
Syntax Error on in /js/newPvz-compiled.js line 37
Expected behavior/code
It should work in IE
Babel Configuration (.babelrc, package.json, cli command)
.babelrc
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "ie >= 11"]
},
"useBuiltIns": true
}],
]
}
package.json
{
"scripts": {
"minify": "node minify.js"
},
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"less": "^3.0.1",
"minifier": "0.8.1",
"vue2-filters": "^0.3.0",
"watch": "^1.0.2",
"webpack": "^4.6.0",
"babel-polyfill": "6.26.0",
"babel-preset-es2015-ie": "6.7.0"
},
"devDependencies": {
"babel-preset-env": "^1.7.0"
}
}
cli
$ webpack
$ ./babel-cli/bin/babel.js --presets babel-preset-es2015-ie /js/newPvz-webpack.js -o /js/newPvz-compiled.js
Environment
- Babel version(s): babel-1.4.0
- Node/npm version: v4.2.6
- OS: Windows 10
- Monorepo [e.g. yes/no/Lerna]
- cli
Possible Solution I tried to add babel-preset-es2015 and configure IE as supported browsers in .babelrc
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Problem with JS output on IE11 using babel - Stack Overflow
The library comes as an es-module compiled for evergreen browsers with the following browserlist config: >1%, not dead, not ie 11, not op_mini ......
Read more >Support IE 11 Using Babel and Webpack | by Rameez Aijaz
In this article, I will be focusing on converting Typescript code to ES5 using Webpack and Babel 7 configuration. Let's gets started.
Read more >Why you don't need Babel - LogRocket Blog
Babel is a compiler that converts your modern JavaScript to run in older browsers. It can also perform other jobs such as converting...
Read more >Solving IE11 Compatibility Problems of Node_Modules ... - petkir
The most common way is to use babel-loader in webpack to solve this issue. In your SPFx solution you have to add additional...
Read more >Using Babel and Webpack to compile ES7 code to ES5 for IE ...
How was the freelance job? He helped me walk through some adjusting of code to work in IE11. He was polite, knowledgeable, and...
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 Free
Top 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
I’m sorry, this problem is not related to Babel. I found the solution. Had to add
devtools
to webpack.config to removeeval
You can close this issue.
@zhuangya
That’s not what the docs say: https://docs.microsoft.com/en-us/scripting/javascript/reference/let-statement-javascript