s00d/webpack-shell-plugin-next

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

evangalen opened this issue · 4 comments

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

updated

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

try onFailedBuild

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.