'In a Webpack 4 plugin, determine if the build was the initial build, or rebuild from a watched and changed file
I've created a custom Webpack 4 plugin that uses the done hook to trigger some behavior when each Webpack build is complete. While in dev mode, ie running webpack-dev-server, I need it to determine if the build was the initial startup build, or a rebuild triggered by a change in a file being watched. I've tried looking through stats and stats.compilation but haven't found any property that I can use for this.
compiler.hooks.done.tapAsync('My Plugin', (stats, callback) => {
// If initial build, do A
// Else if rebuild, do B
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
