如何禁用Webpack输出资产文件夹文件“ SRC”?

时间:2019-12-20 14:42:23

标签: webpack webpack-4 webpack-splitchunks

我想在构建中禁用Webpack src.js文件。因为它很空,什么也没坐。

(window.webpackJsonp=window.webpackJsonp||[]).push([[3],[],[[39,2,1,0]]]);

这是该文件中唯一的东西。

输出的文件:

mywebsite-vendors.min.b08ecf8da2828e0bd685.js
mywebsite.min.b08ecf8da2828e0bd685.js
runtime.min.b08ecf8da2828e0bd685.js
src.min.b08ecf8da2828e0bd685.js

如何禁用此文件?

部分Webpack代码:

optimization: {
    minimize: ifProduction(true, false),
    namedModules: ifDevelopment(true, false),
    runtimeChunk: 'single',
    noEmitOnErrors: true,
    splitChunks: {
        hidePathInfo: true,
        chunks: 'all',
        automaticNameDelimiter: '-',
        maxAsyncRequests: 6,
        maxInitialRequests: 4,
        name: THEME_NAME,
        cacheGroups: {
            default: {
                enforce: true,
                priority: 1
            },
            vendors: {
                test: /[\\/]node_modules[\\/]/,
                name: `${THEME_NAME}-vendors`,
                enforce: true,
                priority: 2,
                chunks: 'all'
            }
        }
    },

    minimizer: [
        new TerserPlugin({
            test: /\.js(\?.*)?$/i,
            cache: true,
            parallel: true,
            sourceMap: ifDevelopment(true, false),
            extractComments: false,
            terserOptions: {
                compress: {
                    drop_console: ifProduction(true, false)
                }
            },
            exclude: /\/node_modules/
        })
    ]
},

0 个答案:

没有答案