https://github.com/fiverr/afterbuild-webpack-plugin
A webpack plugin that registers a callback function to run after the build has finished
https://github.com/fiverr/afterbuild-webpack-plugin
Last synced: about 2 months ago
JSON representation
A webpack plugin that registers a callback function to run after the build has finished
- Host: GitHub
- URL: https://github.com/fiverr/afterbuild-webpack-plugin
- Owner: fiverr
- Created: 2020-05-25T14:41:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-25T06:34:49.000Z (almost 2 years ago)
- Last Synced: 2025-04-07T06:17:01.717Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 5
- Watchers: 37
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[![npm][npm]][npm-url]
[![node][node]][node-url]# AfterBuild Webpack Plugin
A webpack plugin that registers a callback function to run after the build has finished
## Requirements
This module requires a minimum of Node 8.
## Getting Started
First, install the plugin as a dev dependency:
```console
$ npm i @fiverr/afterbuild-webpack-plugin -D
```Then add it to the list of plugins in your `webpack` config:
```js
const AfterBuildPlugin = require('@fiverr/afterbuild-webpack-plugin');module.exports = {
plugins: [
new AfterBuildPlugin(doSomething)
]
};
```## Arguments
The plugin receieves one argument - a callback function to run once the build has finished.
## Example - Send a Slack notification post-build
```js
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)
]
};
```[npm]: https://img.shields.io/npm/v/@fiverr/afterbuild-webpack-plugin.svg
[npm-url]: https://npmjs.com/package/@fiverr/afterbuild-webpack-plugin
[node]: https://img.shields.io/node/v/@fiverr/afterbuild-webpack-plugin.svg
[node-url]: https://nodejs.org