-
Notifications
You must be signed in to change notification settings - Fork 125
CI build does not bail with proper exit code #133
Comments
This is a duplicate of #19 - I can't see a fix on happypack's end (at least for webpack 1, didn't check for webpack 2.) Can you try using the NoErrors plugin without the bail option? Wouldn't that result in the same behaviour? |
@amireh All loaders, plugins, etc. can report errors to webpack. As described here:
IMHO I'm really sure that this is an issue on HappyPack's side. |
Meanwhile the quickfix is to simply disable happypack for production builds, unfotunately. |
It both is and isn't: webpack isn't emitting the signal when it should, so happypack has no means to clean up in a |
I see your point. |
I've revisited this for our own CI and it still can't be fixed on happypack's side. Webpack (1 at least) fails to emit any kind of signal when Closing as can't fix. |
Here's a variant of the fix we've applied: since it's not possible to get at the errors from the plugin/loader layer during bail, you need to invoke webpack using the node API and register a callback that will exit the process correctly: #!/usr/bin/env node
// @file: bailing-webpack.js
var webpack = require('webpack');
var path = require('path')
var config = require(path.resolve(process.argv[2]))
webpack(config, function(err, rawStats) {
if (err) {
console.error(err.stack);
process.exit(1);
}
else {
var stats = rawStats.toJson();
if (stats.errors.length > 0) {
stats.errors.forEach(function(moduleErr) {
console.error(moduleErr.stack);
})
process.exit(1);
}
else {
process.exit(0);
}
}
}) The downside here is that you're no longer using the webpack CLI so you can't pass in command line arguments (unless you wrap them yourself) but it shouldn't be much of a problem for CI builds. |
I have also just verified that --bail works as expected in both webpack 2 and 3. |
@amireh |
No problem! I'll see if I get time to submit a PR to webpack 1 and apply a real fix, then we won't need to do anything. But not sure if they're still maintaining that branch (or accepting PRs for it.) |
@amireh |
HappyPack causes my CI build to hang on error (it seems active pipe are lying around), instead it should bail properly with a non zero exit code as defined by webpacks
--bail
option.If I disable HappyPack, webpack exits properly with non zero exit code.
The text was updated successfully, but these errors were encountered: