Skip to content

Commit

Permalink
use chunk-hash event
Browse files Browse the repository at this point in the history
  • Loading branch information
erm0l0v committed Aug 24, 2015
1 parent 34dca78 commit ba0e851
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions plugin/webpack_md5_hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ function WebpackMd5Hash () {

WebpackMd5Hash.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation) {
compilation.plugin("after-hash", function() {
for (var chunk_id in this.chunks) {
if (this.chunks.hasOwnProperty(chunk_id)) {
var chunk = this.chunks[chunk_id];
var source = chunk.modules.sort(compareModules).map(getModuleSource).reduce(concatenateSource);
chunk.renderedHash = md5(source);
}
}
compilation.plugin("chunk-hash", function(chunk, chunkHash) {
var source = chunk.modules.sort(compareModules).map(getModuleSource).reduce(concatenateSource);
chunk.hash = md5(source);
});
});
};
Expand Down

0 comments on commit ba0e851

Please sign in to comment.