From 1bc2a1a8cee6f43e3ce282e3871a77b2438b2c5f Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Mon, 9 Jan 2023 15:56:03 -0800 Subject: [PATCH] add caching and hashing --- makefile | 2 +- webpack.config.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index 3e5d349..9ed17a0 100644 --- a/makefile +++ b/makefile @@ -4,5 +4,5 @@ build: serve: npx webpack serve --no-open -dev-server: +serve-dist: python -m http.server --directory dist/ 8700 diff --git a/webpack.config.js b/webpack.config.js index 1ee1bf9..d85f890 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -19,15 +19,24 @@ module.exports = { ], output: { clean: true, - filename: '[name].bundle.js', + filename: '[name].[contenthash].bundle.js', path: relpath('dist'), }, devServer: { static: relpath('dist'), }, optimization: { - // fixes problems when bundling more than one entry + moduleIds: 'deterministic', runtimeChunk: 'single', + splitChunks: { + cacheGroups: { + vendor: { + test: /[\\/]node_modules[\\/]/, + name: 'vendors', + chunks: 'all', + }, + }, + }, }, performance: { // hides the performance warnings for now