Closed panta82 closed 9 months ago
Nice catch!
Would you mind opening a PR with fix + test?
I wouldn't mind. I mostly didn't because I don't have this project set up, and testing this seems like it would be tricky. Let me check it out, and I'll let you know if I can handle it.
Figured it out, I think.
Problem
When there is a problem with module resolution during build, webpack emits "
finishModules
" event with an empty set.esbuild-loader responds to this event by trying to extract
useSourceMap
. Since it is given an empty set, it crashes on this line: https://github.com/privatenumber/esbuild-loader/blob/develop/src/plugin.ts#L212Suggested fix:
Expected behavior
Webpack is able to finish and report the actual error.
Minimal reproduction URL
https://stackblitz.com/edit/node-t2tcae?file=webpack.config.js,package.json&view=editor
Version
4.0.2
Node.js version
16.20.0
Package manager
npm
Operating system
Linux
Contributions