From a684d245e02501521cb870fef88c056600e89055 Mon Sep 17 00:00:00 2001 From: HashTalmiz Date: Sat, 25 Apr 2020 11:48:57 +0530 Subject: [PATCH] Renamed [contenthash] to [hash] for cache busting (suggested by an error on npm run dev) npm run build shows the hashed files!! --- webpack.config.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 4b5576768..5ebf3d500 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -49,20 +49,6 @@ const generateConfig = ({ extensionPath, devMode = false, customOutputPath, anal threshold: 10240, minRatio: 0.8 }); - /* Cache busting; plugin to automatically insert the script tag of content hashed JS file(auspice.bundle.js) dynamically into HTML files */ - - // function generateHTMLplugins(fileName,absolutefilePath) { - // return new HtmlWebpackPlugin({ - // filename: fileName, - // template: `${absolutefilePath}` - // } - - const HTMLdependentOnHash = [ - new HtmlWebpackPlugin({ - filename: 'index.html', - template: './index.html' - }) - ]; const plugins = devMode ? [new webpack.HotModuleReplacementPlugin(), pluginProcessEnvData, new webpack.NoEmitOnErrorsPlugin()] @@ -71,7 +57,11 @@ const generateConfig = ({ extensionPath, devMode = false, customOutputPath, anal new webpack.optimize.AggressiveMergingPlugin(), // merge chunks - https://github.com/webpack/docs/wiki/list-of-plugins#aggressivemergingplugin pluginCompress, new CleanWebpackPlugin(), // remove duplicte hash files (created during changes) - ...HTMLdependentOnHash + /* Cache busting; plugin to automatically insert the script tag of content hashed JS file(auspice.bundle.js) dynamically into HTML files */ + new HtmlWebpackPlugin({ + filename: 'index.html', + template: './index.html' + }) ]; if (analyzeBundle) { @@ -99,8 +89,8 @@ const generateConfig = ({ extensionPath, devMode = false, customOutputPath, anal entry, output: { path: outputPath, - filename: 'auspice.[contenthash].bundle.js', - chunkFilename: 'auspice.[contenthash].chunk.[name].bundle.js', + filename: 'auspice.[hash].bundle.js', + chunkFilename: 'auspice.[hash].chunk.[name].bundle.js', publicPath: '/dist/' }, resolve: {