-
-
Notifications
You must be signed in to change notification settings - Fork 69
Description
Hi,
I'm currently utilizing webpack-dev-server & webpack-hot-middleware to marry with my own assets/express server/build processes/etc. I recently decided to add your plugin to my build process and one of the keys I noticed right away was "failOnError". I took a look through your source and noticed that when this parameter is present, you are piping an Error() object to webpack (https://github.com/JaKXz/stylelint-webpack-plugin/blob/master/lib/run-compilation.js#L35). This seems to work nicely for running webpack in a single build on its own (as failing the webpack build outright isn't an issue), but when we want webpack to pause building (but still listen for file changes and rebuild, which is a feature of webpack-dev-server), this failOnError key will actually stop webpack entirely (e.g. the build will no longer listen to file changes/attempt to rebuild/etc and we then have to restart the entire webpack bundling process/etc).
I found this behavior strange, because I use eslint-loader and it's failOnError key doesn't throw an error necessarily; it gracefully halts the webpack build process and still allows webpack to listen for file changes/etc and rebuild accordingly. I believe the reason is due to how eslint-loader pipes its response back to webpack. In particular, it looks like rather than throwing an error, it gets the current webpack instance and utilizes the emitError function under webpack (https://github.com/MoOx/eslint-loader/blob/master/index.js#L105).
I'd be curious to hear your thoughts and if I'm following this correctly.
I would be happy to put a pull request in as well to implement the error handling similar to how eslint-loader does it.
Thanks!