webpack配置CommonsChunkPlugin时出错

报错:"Chunk.entry was removed. Use hasRuntime()"
代码:
const path = require('path');
const webpack = require('webpack');
let config = {

entry: {
    "index" : ["./src/page/index/index.js"],
    'login' : ['./src/page/login/index.js']
},
output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'js/[name].js'
},
externals : {
    'jquery' : 'window.jQuery'
},
plugins : [
    new webpack.optimize.CommonsChunkPlugin({
        name : 'commons',
        filename : 'js/base.js'
    })
]

};
module.exports = config ;

阅读 3.4k
2 个回答

似乎配置并没有错

新手上路,请多包涵

可能是webpack版本太高了,若全局安装的webapck是4.0x的,已移除了CommonsChunkPlugin,请在optimization中配置

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题