Skip to content

Commit c7b9226

Browse files
author
Paulo Rezende
committed
Add support to cache files on Webpack configs
1 parent ad9d78d commit c7b9226

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

webpack.common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
vendor: './statik/scripts/vendor.js'
99
},
1010
output: {
11-
filename: '[name].bundle.js',
11+
filename: '[name].[chunkhash].bundle.js',
1212
path: path.resolve('dist')
1313
},
1414
module: {

webpack.prod.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,17 @@ module.exports = merge(common, {
5555
]
5656
},
5757
optimization: {
58+
runtimeChunk: 'single',
5859
splitChunks: {
5960
chunks: 'all',
60-
name: true
61+
name: true,
62+
cacheGroups: {
63+
vendor: {
64+
test: /[\\/]node_modules[\\/]/,
65+
name: 'vendors',
66+
chunks: 'all'
67+
}
68+
}
6169
},
6270
minimizer: [
6371
new OptimizeCSSAssetsPlugin({
@@ -73,6 +81,7 @@ module.exports = merge(common, {
7381
new UglifyJsWebpackPlugin({
7482
sourceMap: true
7583
}),
84+
new webpack.HashedModuleIdsPlugin(),
7685
new webpack.DefinePlugin({
7786
'process.env.NODE_ENV': JSON.stringify('production')
7887
})

0 commit comments

Comments
 (0)