flow-webpack-plugin icon indicating copy to clipboard operation
flow-webpack-plugin copied to clipboard

webpack --watch process terminates

Open basti1302 opened this issue 7 years ago • 2 comments

With a configuration like

new FlowWebpackPlugin({
  failOnError: true
})

and running webpack -w the webpack process is termintated when Flow errors exist with:

Flow validation failed.
Error: path/to/source.js:42
... more flow error details

I think this is due to the implementation of afterUserCallback in https://github.com/happylynx/flow-webpack-plugin/blob/master/src/index.js#L156-L168. There even is a comment stating

/*
 * argument passed to callback() causes webpack to immediately stop, even in watch mode,
  * don't emit assets, and set return code to 1
  */

There is only a check for plugin.options.failOnError. IMO the code would need to check if it is running in watch mode and just continue by calling webpackCallback() without arguments to avoid stopping the process.

Note: The behaviour is the same, even when explicitly specifying:

new FlowWebpackPlugin({
  failOnError: true,
  failOnErrorWatch: false
})

basti1302 avatar Jan 05 '18 12:01 basti1302

👍 would be interested in this fix as well

ericyliu avatar May 25 '18 15:05 ericyliu

@ericyliu The fix is available in PR #8 since early January but @happylynx seems to be gone. Maybe I should publish my fixed fork to npm.

basti1302 avatar May 26 '18 08:05 basti1302