Skip to content

Commit

Permalink
Merge pull request #2 from dsebastien/master
Browse files Browse the repository at this point in the history
Fix for #1 and minor tweaks
  • Loading branch information
erm0l0v committed Feb 12, 2016
2 parents 890c71d + da8efa2 commit 53a3cea
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
node_modules

# Own
example/dest/*
/dist
!example/dest/index.html

# Node
node_modules

# IDEs
.idea
3 changes: 3 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/example
/dist

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Plugin to replace a standard webpack chunkhash with md5.",
"main": "index.js",
"scripts": {
"pretest": "jshint *.js spec plugin example/js",
"clean": "rimraf dist",
"pretest": "jshint",
"test": "jasmine-node --captureExceptions spec"
},
"repository": {
Expand All @@ -18,6 +19,11 @@
"md5"
],
"author": "Kirill Ermolov",
"contributors": [{
"name": "Sebastien Dubois",
"email": "seb@dsebastien.net",
"url": "https://www.dsebastien.net"
}],
"license": "MIT",
"bugs": {
"url": "https://github.com/erm0l0v/webpack-md5-hash/issues"
Expand Down
4 changes: 2 additions & 2 deletions plugin/webpack_md5_hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function WebpackMd5Hash () {
WebpackMd5Hash.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation) {
compilation.plugin("chunk-hash", function(chunk, chunkHash) {
var source = chunk.modules.sort(compareModules).map(getModuleSource).reduce(concatenateSource);
var source = chunk.modules.sort(compareModules).map(getModuleSource).reduce(concatenateSource, ''); // we provide an initialValue in case there is an empty module source. Ref: http://es5.github.io/#x15.4.4.21
var chunk_hash = md5(source);
chunkHash.digest = function () {
return chunk_hash;
Expand All @@ -37,4 +37,4 @@ WebpackMd5Hash.prototype.apply = function(compiler) {
});
};

module.exports = WebpackMd5Hash;
module.exports = WebpackMd5Hash;

0 comments on commit 53a3cea

Please sign in to comment.