admin管理员组文章数量:1325236
When process.env.NODE_ENV=='development'
- it is OK!
But our production build failed in IE 11 (11.0.9600). All work fine in chrome 55.
devDependencies:
...
babel-core: "6.22.0",
babel-eslint: "^7.0.0",
babel-loader: "^6.2.5",
babel-preset-env: "^1.5.2",
babel-preset-es2015: "^6.16.0",
babel-preset-es2016: "^6.22.0",
babel-preset-es2017: "^6.16.0",
babel-preset-react: "^6.16.0",
babel-preset-stage-0: "^6.22.0"
...
dependencies:
...
babel-polyfill: "^6.16.0"
...
.babelrc:
{
"presets": [
"react",
["env", {
"useBuiltIns": true
}],
"stage-0"
]
}
Try "useBuiltIns": false
, es2016, es2015, es2017 presets. Nothing changes.
index.js:
"use strict";
import 'babel-polyfill'
...
webpack.config module.exports.entry:
vendor: ['babel-polyfill', 'immutable', 'react', 'react-dom', ...],
...
bundle: [path.resolve(__dirname, srcPath + ""index.js)]
vendor is the first script in index.html.
Typing _babelPolyfill in ie console return true. But Headers, fetch are undefined...
Why process.env.NODE_ENV=='production'
broke my app in IE11?
How to fix my config?
When process.env.NODE_ENV=='development'
- it is OK!
But our production build failed in IE 11 (11.0.9600). All work fine in chrome 55.
devDependencies:
...
babel-core: "6.22.0",
babel-eslint: "^7.0.0",
babel-loader: "^6.2.5",
babel-preset-env: "^1.5.2",
babel-preset-es2015: "^6.16.0",
babel-preset-es2016: "^6.22.0",
babel-preset-es2017: "^6.16.0",
babel-preset-react: "^6.16.0",
babel-preset-stage-0: "^6.22.0"
...
dependencies:
...
babel-polyfill: "^6.16.0"
...
.babelrc:
{
"presets": [
"react",
["env", {
"useBuiltIns": true
}],
"stage-0"
]
}
Try "useBuiltIns": false
, es2016, es2015, es2017 presets. Nothing changes.
index.js:
"use strict";
import 'babel-polyfill'
...
webpack.config module.exports.entry:
vendor: ['babel-polyfill', 'immutable', 'react', 'react-dom', ...],
...
bundle: [path.resolve(__dirname, srcPath + ""index.js)]
vendor is the first script in index.html.
Typing _babelPolyfill in ie console return true. But Headers, fetch are undefined...
Why process.env.NODE_ENV=='production'
broke my app in IE11?
How to fix my config?
1 Answer
Reset to default 6core.js do not have polyfill for Headers() and fetch, so babel-polyfill don't. Use one of fetch polyfills:
- whatwg-fetch polyfill for browsers only support https://github./github/fetch
- isomorphic-fetch - polyfill, based on whatwg-fetch, for node and browsers support
For more info:
https://github./zloirock/core-js
What is the difference between isomorphic-fetch and fetch?
本文标签:
版权声明:本文标题:javascript - fetch and Headers are undefined in IE11.0.9600 with babel-polyfill when process.env.NODE_ENV=='production&a 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742169152a2426392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论