| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This plugin allows you to run any shell commands before or after webpack builds. This will work for both webpack and webpack-dev-server.
Goes great with running cron jobs, reporting tools, or tests such as selenium, protractor, phantom, ect.
npm install --save-dev webpack-hook-plugin
In webpack.config.js:
import WebpackHookPlugin from 'webpack-hook-plugin';
module.exports = {
//...
//...
plugins: [
new WebpackHookPlugin({
onBuildStart:['echo "Webpack Start"'],
onBuildEnd:['echo "Webpack End"']
})
],
//...
}Insert into your webpack.config.js:
import WebpackHookPlugin from 'webpack-hook-plugin';
const path = require('path');
var plugins = [];
plugins.push(new WebpackHookPlugin({
onBuildStart: ['echo "Starting"'],
onBuildEnd: ['python script.py && node script.js']
}));
var config = {
entry: {
app: path.resolve(__dirname, 'src/app.js')
},
output: {
path: path.resolve(__dirname, 'dist'), // regular webpack
filename: 'bundle.js'
},
devServer: {
contentBase: path.resolve(__dirname, 'src') // dev server
},
plugins: plugins,
module: {
loaders: [
{test: /\.js$/, loaders: 'babel'},
{test: /\.scss$/, loader: 'style!css!scss?'},
{test: /\.html$/, loader: 'html-loader'}
]
}
}
module.exports = config;Once the build finishes, a child process is spawned firing both a python and node script.
If this plugin is helpful, please click star to support it.
| Back | FazBrowse Home | New Git URL |