From 48da7813e9e2c085920ec8ba07a5f3c33e922110 Mon Sep 17 00:00:00 2001 From: Uwe Ilgenstein Date: Wed, 4 Sep 2024 17:28:41 +0200 Subject: [PATCH 1/2] add content hash to webpack build --- config/webpack/webpack.common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/webpack/webpack.common.js b/config/webpack/webpack.common.js index 7b19a38561..a45e5ecc76 100644 --- a/config/webpack/webpack.common.js +++ b/config/webpack/webpack.common.js @@ -26,7 +26,7 @@ module.exports = { // Output output: { - filename: "_nuxt/js/[name].js", + filename: "_nuxt/js/[name]-[contenthash].js", path: path.resolve(__base, "dist"), publicPath: "/", chunkFilename: "_nuxt/js/[name].js", From f179dcf46732242fd044a75249f865eb562131ff Mon Sep 17 00:00:00 2001 From: Uwe Ilgenstein Date: Wed, 4 Sep 2024 19:02:44 +0200 Subject: [PATCH 2/2] add chunk content hash --- config/webpack/webpack.common.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/config/webpack/webpack.common.js b/config/webpack/webpack.common.js index a45e5ecc76..37e515e7e3 100644 --- a/config/webpack/webpack.common.js +++ b/config/webpack/webpack.common.js @@ -25,13 +25,16 @@ module.exports = { }, // Output - output: { - filename: "_nuxt/js/[name]-[contenthash].js", - path: path.resolve(__base, "dist"), - publicPath: "/", - chunkFilename: "_nuxt/js/[name].js", - clean: true, - }, + output: + process.env.NODE_ENV === "development" + ? {} + : { + filename: "_nuxt/js/[name]-[contenthash:6].js", + chunkFilename: "_nuxt/js/[name]-[contenthash:6].js", + path: path.resolve(__base, "dist"), + publicPath: "/", + clean: true, + }, // Optimizations optimization: {