我需要帮助诊断和修复此错误:
"Error: only one instance of babel-polyfill is allowed"
我的 package.json 中有以下内容:
"devDependencies": {
"babel-core": "^6.23.1",
"babel-jest": "^19.0.0",
"babel-loader": "^6.3.2",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.23.0" ...
"dependencies": {
"babel-polyfill": "^6.23.0" ...
我的 webpack 配置中的这个和这个入口行:
entry: ["babel-polyfill", path.resolve(APP_PATH, 'index')],
...
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
// specify that we will be dealing with React code
presets: ['react', 'es2015']
}
}
]}