我正在探索将jQuery从某些Webpack捆绑包中排除的机会。例如,我的webpack.config.js有两个入口点
module.exports = {
entry: {
'index/index': [ 'babel-polyfill', './resources/assets/modules/index/index', ],
'auth/index': [ 'babel-polyfill', './resources/assets/modules/auth/index', ],
},
...
plugins: [
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery',
Popper: ['popper.js', 'default',],
}),
...
],
}
在捆绑分析器中,我看到auth/index
和index/index
捆绑中都包含jQuery。但是实际上,我仅在index/index
模块中需要jQuery。我该怎么办?
PS Webpack版本3