s00d / webpack-shell-plugin-next

Run shell commands either before or after webpack 4 and 5 builds
MIT License
92 stars 12 forks source link

Webpack build should fail when shell script returns a non-`0` exit code #8

Closed evangalen closed 5 years ago

evangalen commented 5 years ago

Currently the "Webpack Shell Plugin Next" does "not" fail the webpack build whenever the shell script returns a non-0 exit code.

I'm using the following webpack config:

// ...
const WebpackShellPlugin = require('webpack-shell-plugin-next');

module.exports = {
    // ...
    new WebpackShellPlugin({
      onBuildExit:{
        scripts: ['node fail-with-exit-code-1.js'],
        blocking: true,
        parallel: false
      }
    }),
  ]
};

And the fail-with-exit-code-1.js is as follows:

process.exit(1);
s00d commented 5 years ago

updated

ljwagerfield commented 1 year ago

Still struggling with this issue -- I've tried versions 2.3.1, 2.0.8, and 1.1.0 -- in all versions, the build succeeds with a 0 exit code if the onBuildExit script returns a 1.

I've used the same configuration as pasted above by @evangalen

s00d commented 1 year ago

try onFailedBuild

KristianWindsorLibDib commented 1 year ago

I'm also experiencing this issue.

With code like this:

onBuildEnd: {
    scripts: [
        'exit 1'
    ]
},
onBuildExit: {
    scripts: [
        'exit 1'
    ]
},
onBuildError: {
    scripts: [
        'echo "here"'
    ]
},
onFailedBuild: {
    scripts: [
        'echo "here"'
    ]
}

Neither onBuildError nor onFailedBuild ever run.