webpack-shell-plugin-next
webpack-shell-plugin-next copied to clipboard
onBuildStart scripts runs multiple times
Hi,
I’m running some scripts with this plugin using the onBeforeBuild, onBuildStart, and onBuildEnd hooks on build process. I’ve noticed that the pre-build scripts execute multiple times regardless. I have recursive function inside node ./build/scripts/cleanupTemp.js task. If onBuildStart has more than one task, the issue occurs
My config:
plugins: [
// Other configs
new WebpackShellPluginNext({
onBeforeBuild: {
scripts: [
'echo "NPM version => $(npm -v)"',
'echo "Node version => $(node -v)"'
]
},
onBuildStart: {
scripts: [
'echo "Webpack Start"',
'node ./build/scripts/cleanupTemp.js'
]
},
onBuildEnd: {
scripts: [
'echo "Webpack End"',
'node ./build/scripts/postBuild.js',
'node ./build/entryLoad.js',
],
blocking: true
}
}),
// Other configs
Log:
Package version: Tested with 2.2.2 and the latest 2.3.3 → same issue.
I have tried with node v22.11.0 and v24.5.0 versions.!
and onBeforeBuild scripts are not executing either
@s00d Do I need to do change any config or something?. If yes please let me know.! (I'm using rspack for build compilation)
Hi, I have a test file in the project root to check how https://github.com/s00d/webpack-shell-plugin-next/blob/master/webpack.config.ts works. As you can see in the screenshot, there are no repeated runs. I can’t say for sure what the issue is on your side — I’ll need a test project where I can reproduce the problem.