Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Inlines a throw
statement into a bundle when a module is missing
If the current behavior is a bug, please provide the steps to reproduce.
- Clone this repository
- Run
npm install
- Run
npm start
- Open
dist/bundle.js
and grep forCannot find module
What is the expected behavior?
My expectation is that webpack
would throw at build time, instead of inlining code to throw at runtime, when a module cannot be found. This would be an easy to miss bug if the throw
statement is in a chunk that doesn’t happen to be covered by E2E or manual testing.
If this is a feature request, what is motivation or use case for changing the behavior?
Would make it easier to catch cases where a module can’t be found
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
This happens in the latest webpack stable at the time of writing (3.10.0
).
I’m trying to figure out if there was a specific reason that this behavior needed to happen at run-time, or if this was just overlooked.
This is related to #4959, but it’s likely other bugs could cause this same problem (anytime dep.module
is falsy), so I think this merits being tracked separately.
I guess maybe I should rephrase “throw at build time” to “report a module error”. IOW, like
webpack
does today for mistyped paths or missing dependencies.