Skip to content

Commit

Permalink
Remove hash when running as dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
gotdan committed Apr 30, 2017
1 parent 6fd1ad1 commit 016221f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ var fs = require("fs");
var path = require("path");

getPlugins = function() {
if (process.env.WEBPACK_ENV != 'build') return;

var fileChangerOptions = {
var optionsDev = {
change: [{
file: path.join(__dirname, './public/index.html'),
parameters: {'bundle\.(.+)\.js': 'bundle.js'}
}]
}
var optionsBuild = {
change: [{
file: './public/index.html',
parameters: {
'bundle\.(.+)\.js': 'bundle.[renderedHash:0].js'
'bundle(\..+)?\.js': 'bundle.[renderedHash:0].js'
},
// delete all but most recent bundle
before: function(stats, change) {
Expand All @@ -27,8 +31,8 @@ getPlugins = function() {
}
}]
};

return [ new FileChanger(fileChangerOptions) ]
var options = process.env.WEBPACK_ENV === 'build' ? optionsBuild : optionsDev;
return [ new FileChanger(options) ]
};

module.exports = {
Expand Down

0 comments on commit 016221f

Please sign in to comment.