Webpack 4优化runtimechunk,runtime.js不能用chunkhash命名吗?

时间:2018-08-14 03:07:29

标签: webpack-4

首先: webpack.config

mode: 'development',
name: 'dev',
target: 'web',
entry: {
    'app': [
        'webpack/hot/dev-server',
        APP_DIR + '/client/app.tsx'
    ]
},
output: {
    filename: '[name].js',
    chunkFilename: '[name].[chunkhash].js',
    path: BUILD_DIR,
    publicPath: 'http://localhost:8080/'
},
optimization: {
    runtimeChunk: 'single',
    splitChunks: {
        cacheGroups: {
            vendors: {
                test: /[\\/]node_modules[\\/]/,
                name: 'vendor',
                priority: -20,
                chunks: 'all'
            }
        }
    }
},

以下是标准输出,runtime.js的名称上没有哈希码。

runtime.js has no hashcode

第二:当我如下更改输出时:

output: {
    filename: '[name].[chunkhash].js',
    path: BUILD_DIR,
    publicPath: 'http://localhost:8080/'
},

我得到以下结果:

enter image description here

我如何像其他块文件一样对命名为runtime.js文件的哈希码?

0 个答案:

没有答案