Skip to content

Commit

Permalink
Renamed [contenthash] to [hash] for cache busting (suggested by an er…
Browse files Browse the repository at this point in the history
…ror on npm run dev)

npm run build shows the hashed files!!
  • Loading branch information
HashTalmiz committed Apr 25, 2020
1 parent 9ef4fc7 commit a684d24
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand All @@ -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) {
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit a684d24

Please sign in to comment.