Reputation: 100010
I have a build step (a hook) that needs to happen after webpack --watch finishes. Has anyone had success hooking into webpack --watch to determine when it has completed?
In other words it would like this:
webpack --watch
in the backgroundwebpack --watch
creates a new buildwebpack
completes the rebuilddoes anyone know a good way of doing this?
Upvotes: 1
Views: 464
Reputation: 2348
The simplest way I think will be to use the webpack-shell-plugin
plugin. It allows you to run any shell commands before or after webpack builds. Just install it with npm install --save-dev webpack-shell-plugin
and edit your webpack.config.js
:
const WebpackShellPlugin = require('webpack-shell-plugin');
module.exports = {
...
...
plugins: [
new WebpackShellPlugin({onBuildStart:['echo "Webpack Start"'], onBuildEnd:['echo "Webpack End"']})
],
...
}
Review plugin docs for a more info.
Upvotes: 1