Skip to content

Commit f5cc167

Browse files
evilebottnawimastilver
authored andcommitted
fix: always run hooks last for webpack@4 (#142)
1 parent 24acf95 commit f5cc167

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

lib/plugin.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,19 @@ ManifestPlugin.prototype.apply = function(compiler) {
203203

204204
if (compiler.hooks) {
205205
const SyncWaterfallHook = require('tapable').SyncWaterfallHook;
206+
const pluginOptions = {
207+
name: 'ManifestPlugin',
208+
stage: Infinity
209+
};
206210
compiler.hooks.webpackManifestPluginAfterEmit = new SyncWaterfallHook(['manifest']);
207211

208-
compiler.hooks.compilation.tap('ManifestPlugin', function (compilation) {
209-
compilation.hooks.moduleAsset.tap('ManifestPlugin', moduleAsset);
212+
compiler.hooks.compilation.tap(pluginOptions, function (compilation) {
213+
compilation.hooks.moduleAsset.tap(pluginOptions, moduleAsset);
210214
});
211-
compiler.hooks.emit.tap('ManifestPlugin', emit);
215+
compiler.hooks.emit.tap(pluginOptions, emit);
212216

213-
compiler.hooks.run.tap('ManifestPlugin', beforeRun);
214-
compiler.hooks.watchRun.tap('ManifestPlugin', beforeRun);
217+
compiler.hooks.run.tap(pluginOptions, beforeRun);
218+
compiler.hooks.watchRun.tap(pluginOptions, beforeRun);
215219
} else {
216220
compiler.plugin('compilation', function (compilation) {
217221
compilation.plugin('module-asset', moduleAsset);

0 commit comments

Comments
 (0)