A better child_process for webpack.
npm i -D execa-webpack-pluginwebpack.config.js
const ExecaPlugin = require("execa-webpack-plugin");
module.exports = {
plugins: [
new ExecaPlugin({
onBuildStart: [
{
args: ["build"],
cmd: "del"
}
]
})
]
};| Name | Type | Default | Description |
|---|---|---|---|
onBuildStart |
{Array} |
[] |
Array of scripts to execute on the initial build. |
onBuildEnd |
{Array} |
[] |
Array of scripts to execute after files are emitted at the end of the compilation. |
onBuildExit |
{Array} |
[] |
array of scripts to execute after webpack's process is complete. |
bail |
{Boolean} |
compiler.options.bail |
Report the first error as a hard error instead of tolerating it. |
dev |
{Boolean} |
true |
Switch for development environments. This causes scripts to execute once. Useful for running HMR on webpack-dev-server or webpack watch mode. |
logLevel |
string |
warn |
Enable logging. |
[
new ExecaPlugin({
onBuildStart: [
{
args: ["build"],
cmd: "del"
}
]
})
];[
new ExecaPlugin({
onBuildEnd: [
{
args: ["trash"],
cmd: "del"
}
]
})
];[
new ExecaPlugin({
onBuildExit: [
{
args: ["trash"],
cmd: "del"
}
]
})
];[
new ExecaPlugin({
bail: true,
onBuildStart: [
{
args: ["build"],
cmd: "del"
}
]
})
];[
new ExecaPlugin({
dev: true,
onBuildStart: [
{
args: ["build"],
cmd: "del"
}
]
})
];[
new ExecaPlugin({
logLevel: "info",
onBuildStart: [
{
args: ["build"],
cmd: "del"
}
]
})
];- execa - API.