add caching and hashing

This commit is contained in:
Michael Peters 2023-01-09 15:56:03 -08:00
parent f1acb9fe99
commit 1bc2a1a8ce
2 changed files with 12 additions and 3 deletions

View File

@ -4,5 +4,5 @@ build:
serve: serve:
npx webpack serve --no-open npx webpack serve --no-open
dev-server: serve-dist:
python -m http.server --directory dist/ 8700 python -m http.server --directory dist/ 8700

View File

@ -19,15 +19,24 @@ module.exports = {
], ],
output: { output: {
clean: true, clean: true,
filename: '[name].bundle.js', filename: '[name].[contenthash].bundle.js',
path: relpath('dist'), path: relpath('dist'),
}, },
devServer: { devServer: {
static: relpath('dist'), static: relpath('dist'),
}, },
optimization: { optimization: {
// fixes problems when bundling more than one entry moduleIds: 'deterministic',
runtimeChunk: 'single', runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
}, },
performance: { performance: {
// hides the performance warnings for now // hides the performance warnings for now