From 6b44e69418510b997e89bc2e84c7bfbdc05d7d30 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Tue, 20 Jun 2017 10:44:58 +0200 Subject: [PATCH] Update to chunk.mapModules Chunk.modules is deprecated in Webpack 3.0.0 - replaced with the mapModules method. Added with fallback, to support Webpack 2.0.0 --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 637a618..aeb5a58 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,8 @@ WebpackChunkHash.prototype.apply = function(compiler) { compilation.plugin('chunk-hash', function(chunk, chunkHash) { - var source = chunk.modules.map(getModuleSource).sort(sortById).reduce(concatenateSource, '') + var modules = chunk.mapModules ? chunk.mapModules(getModuleSource) : chunk.modules.map(getModuleSource) + var source = modules.sort(sortById).reduce(concatenateSource, '') , hash = crypto.createHash(_plugin.algorithm).update(source + _plugin.additionalHashContent(chunk)) ;