Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bail = true should not kill watch mode on ModuleNotFound error #1794

Closed
spion-h4 opened this issue Feb 15, 2018 · 7 comments · Fixed by #1804
Closed

bail = true should not kill watch mode on ModuleNotFound error #1794

spion-h4 opened this issue Feb 15, 2018 · 7 comments · Fixed by #1804

Comments

@spion-h4
Copy link

Do you want to request a feature or report a bug?

bug

What is the current behavior?

When bail = true, a ModuleNotFound error during a change of the files will cause the entire watch process to either abort or get stuck. Subsequent rebuilds will not happen even if the file changes.

If the current behavior is a bug, please provide the steps to reproduce.

  • run webpack in watch mode
  • add import './non-existant-module' to any file
  • webpack rebuild fails or exits
  • remove the import
  • rebuild is not triggered either due to webpack exit (3.10 and below) or due to hang (3.11)

node version: 8.9.4

Webpack 3.11 made one step towards fixing this with webpack/webpack#5797

However even though the process does not die, rebuilds stop happening.

@sokra
Copy link
Member

sokra commented Feb 18, 2018

Why are you using bail: true with watching? Which advantages are you expecting?

@spion-h4
Copy link
Author

@sokra I have a config file that specifies bail true by default. I was not sure what to expect. Maybe that the first typescript compilation error will abort the current bundling if bail: true, whereas with bail: false bundling will continue despite errors. Certainly not that the process will die in watch mode.

Why am I even allowed to use bail true when watching? Why doesn't webpack ignore the option if its not supposed to be used? Perhaps generate an error?

@sokra
Copy link
Member

sokra commented Feb 19, 2018

https://webpack.js.org/configuration/other-options/#bail

bail will exit webpack when the first error is found. You can use it in watch mode, but it will still exit webpack when the first error is found.

@spion-h4
Copy link
Author

spion-h4 commented Feb 19, 2018

At the very least webpack should generate a warning when you try to set bail and watch to true at the same time.

edit: This can easily happen through config files and forgetting to add --bail=false in watch mode.

@alexander-akait alexander-akait transferred this issue from webpack/webpack Sep 10, 2020
@webpack-bot
Copy link

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@alexander-akait
Copy link
Member

/cc @webpack/cli-team should be easy to implement

@snitin315
Copy link
Member

Yes, I will do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants