A webpack plugin that registers a callback function to run after the build has finished
This module requires a minimum of Node 8.
First, install the plugin as a dev dependency:
$ npm i @fiverr/afterbuild-webpack-plugin -D
Then add it to the list of plugins in your webpack
config:
const AfterBuildPlugin = require('@fiverr/afterbuild-webpack-plugin');
module.exports = {
plugins: [
new AfterBuildPlugin(doSomething)
]
};
The plugin receieves one argument - a callback function to run once the build has finished.
const { WebClient } = require('@slack/web-api');
const AfterBuildPlugin = require('@fiverr/afterbuild-webpack-plugin');
const slackClient = new WebClient('YOUR_SLACK_TOKEN');
const sendSlackNotification = () => {
slackClient.chat.postMessage({
text: 'Build passed successfully!',
channel: 'webpack-builds'
});
}
module.exports = {
plugins: [
new AfterBuildPlugin(sendSlackNotification)
]
};