浏览器IE10
在什么配置都不更改的情况下报错 map,set之类的错误,
在引入 core-js/es6/map core-js/es6/set 之后,开发模式依旧报错,打包后正常,初步怀疑是webpack-dev-server的问题
随后使用 react-app-rewired 添加了@babel/polyfill, 报错 对象不支持“setPrototypeOf”属性或方法 0.chunk.js (554,5)
即使在index.js中单独引入set-prototype-of的polyfill也无效,但是在index.html中使用script标签引入polyfill可以运行,
应该是webpack-dev-server生成的chunk包使用了setPrototypeOf,造成这个chunk中的内容就没有正确加载,所以index.js中的代码就没有开始运行,
求教应该怎么配置可以解决
{
"name": "react-project",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.6.3",
"react-app-rewired": "^1.6.2",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"@babel/polyfill": "^7.0.0"
}
}
config-overrides.js
module.exports = function override(config, env) {
//do stuff with the webpack config...
config.entry.unshift('@babel/polyfill');
return config;
};