David
David

Reputation: 4857

Fail webpack build when plugin throws an error

How do I make my webpack build fail if scripts.js throws an error? Adding --bail as a flag or as a configuration option does not work.

// webpack.config.js
const SynchronizableShellPlugin = require('webpack-synchronizable-shell-plugin');

...

bail: true, // this does not work like I expect it to
plugins: {
  new SynchronizableShellPlugin({
    onBuildStart: {
      scripts: ['node script.js'],
      blocking: true
    }
  }),
}

...

Upvotes: 1

Views: 676

Answers (1)

Yakov Surin
Yakov Surin

Reputation: 26

The issue is that this specific plugin does not throw an error in case of script failure. You can use different plugin, e.g. pre-build-webpack.

Upvotes: 1

Related Questions