我的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。
发布于 2017-08-22 12:49:56
您可以通过使用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'
}
};https://stackoverflow.com/questions/42300019
复制相似问题