如何从某些webpack包中排除jQuery?

时间:2018-06-25 14:28:05

标签: javascript jquery webpack

我正在探索将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/indexindex/index捆绑中都包含jQuery。但是实际上,我仅在index/index模块中需要jQuery。我该怎么办?

PS Webpack版本3

0 个答案:

没有答案