我的webpack配置看起来非常像这样 -
entry: {
main: './src/lib/bootstrap.ts',
sw: './src/sw/sw-bootstrap.ts'
},
output: {
path: path.resolve(__dirname, 'public'),
filename: '[name]-[chunkhash].js'
}
在我的情况下,我希望sw-bootstrap
没有附加chunkhash
。
答案 0 :(得分:0)
您可以通过将Webpack的CommonChunksPlugin
与条目结合使用来实现这一目标:
<强> webpack.config.js 强>
const path = require('path');
const webpack = require('webpack');
const config = {
entry: {
main: './src/lib/bootstrap.ts',
sw: './src/sw/sw-bootstrap.ts'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'sw',
chunks: ['sw'], // Use here the same keys as under "entry"
filename: '[name].js'
})
],
output: {
path: path.resolve(__dirname, 'public'),
filename: '[name]-[chunkhash].js'
}
};