Skip to content

Commit

Permalink
Updated hooks for watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
webdeveric committed Dec 28, 2020
1 parent 6b28320 commit cca0785
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/WebpackAssetsManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ class WebpackAssetsManifest
this.hmrRegex = templateStringToRegExp( hotUpdateChunkFilename, 'i' );
}

const handleBeforeRun = this.handleBeforeRun.bind(this);

compiler.hooks.beforeRun.tap(PLUGIN_NAME, handleBeforeRun);

compiler.hooks.watchRun.tap(PLUGIN_NAME, handleBeforeRun);
compiler.hooks.watchRun.tap(PLUGIN_NAME, this.handleWatchRun.bind(this));

compiler.hooks.compilation.tap(PLUGIN_NAME, this.handleCompilation.bind(this));

Expand Down Expand Up @@ -626,14 +622,12 @@ class WebpackAssetsManifest
// Delete properties instead of setting to {} so that the variable reference
// is maintained incase the `assets` is being shared in multi-compiler mode.
Object.keys( this.assets ).forEach( key => delete this.assets[ key ] );

this.assetNames.clear();
}

/**
* Cleanup before running Webpack
*/
handleBeforeRun()
handleWatchRun()
{
this.clear();
}
Expand Down

0 comments on commit cca0785

Please sign in to comment.