From f5cc167ae8bf5b88bbbd9e44682acf1a5bf012ff Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Thu, 19 Apr 2018 15:22:12 +0300 Subject: [PATCH] fix: always run hooks last for `webpack@4` (#142) --- lib/plugin.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/plugin.js b/lib/plugin.js index 6298349..de26392 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -203,15 +203,19 @@ ManifestPlugin.prototype.apply = function(compiler) { if (compiler.hooks) { const SyncWaterfallHook = require('tapable').SyncWaterfallHook; + const pluginOptions = { + name: 'ManifestPlugin', + stage: Infinity + }; compiler.hooks.webpackManifestPluginAfterEmit = new SyncWaterfallHook(['manifest']); - compiler.hooks.compilation.tap('ManifestPlugin', function (compilation) { - compilation.hooks.moduleAsset.tap('ManifestPlugin', moduleAsset); + compiler.hooks.compilation.tap(pluginOptions, function (compilation) { + compilation.hooks.moduleAsset.tap(pluginOptions, moduleAsset); }); - compiler.hooks.emit.tap('ManifestPlugin', emit); + compiler.hooks.emit.tap(pluginOptions, emit); - compiler.hooks.run.tap('ManifestPlugin', beforeRun); - compiler.hooks.watchRun.tap('ManifestPlugin', beforeRun); + compiler.hooks.run.tap(pluginOptions, beforeRun); + compiler.hooks.watchRun.tap(pluginOptions, beforeRun); } else { compiler.plugin('compilation', function (compilation) { compilation.plugin('module-asset', moduleAsset);