entry: {
page1: '~/page1',
page2: '~/page2',
page3: '~/page3',
lib: ['date-fns', 'lodash'],
vendor: ['vue', 'vuex', 'vue-router']
},
new webpack.optimize.CommonsChunkPlugin({
name: ['vendor', 'lib'],
filename: '[name]-[hash].bundle.js',
}),在上面的配置中,我想从CommonsChunkPlugin中排除page1,因为page1没有任何公共模块。所以在page1中,我只包含了抛出以下错误的page1.js。
vendor-cb4799a58e0e134e2087.bundle.js:1 Uncaught ReferenceError: webpackJsonp is not defined请在这方面帮帮我。
发布于 2018-01-10 16:10:51
尝尝这个
new webpack.optimize.CommonsChunkPlugin({
name: ['vendor', 'lib'],
filename: '[name]-[hash].bundle.js',
}),%u省略了“names”中的%s。希望它能有所帮助:)
发布于 2018-01-12 14:02:28
我遵循了下面的文章,它解决了我的问题https://github.com/webpack/webpack.js.org/issues/1333
https://stackoverflow.com/questions/48182500
复制相似问题