我的React应用程序在Chrome,Firefox和Safari中运行良好,但是当我在Edge或Internet Explorer(> 9)中打开它时,它不会出现,并且控制台中不会显示任何错误。
我已经尝试过安装babel-polyfill,但没有任何改变。
index.js
import 'core-js';
...
ReactDOM.render(app, document.getElementById('root'));
webpack.prod.js
...
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: ''
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
...
]
}
};
.babelrc
{
"presets": [
["env", {
"targets": {
"browsers": [
"> 1%",
"last 2 versions"
]
}
}],
"stage-2",
"react"
],
"plugins": [
"syntax-dynamic-import"
]
}