webpack: Dependency resolution of 3rd-party imports fails
Bug report
What is the current behavior?
yarn run build
in my MWE (note the commit hash in the URL fails with a bunch of resolver errors.
If the current behavior is a bug, please provide the steps to reproduce.
git clone https://github.com/johnrichardrinehart/wouter
git checkout 7d6938c83a311f3e35db55f271e4724822f5e6dc
yarn run build
What is the expected behavior?
yarn run build
should bundle all my assets and stick them in ./dist/
.
Other relevant information:
webpack version: 5.9.0
Node.js version: node v15.3.0
Operating System: Ubuntu 20.10
Additional tools: yarn v2.40.0
(berry
, so yarn set version berry
)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 36 (16 by maintainers)
Commits related to this issue
- remove fullySpecified when resolving a module request with PnP fixes https://github.com/webpack/webpack/issues/12093 — committed to webpack/enhanced-resolve by sokra 4 years ago
So far I think it’s a webpack (enhanced-resolve) bug regarding removing fullySpecified when resolving module request with PnP, but I have to investigate further…
import "react"
is valid when usingtype: "module"
One extra tidbit:
The Node resolver doesn’t support ESM yet (tracked here), so the test you made crashes in Node because of that, but in the case of Webpack it shouldn’t matter because you only use requireToUnqualified, which only resolves bare identifiers (
wouter
) to the package location on the disk. The rest of the resolution (indexes, modules, etc) should be handled by Webpack, and thus work 🤔@johnrichardrinehart anyway feel free to feedback or post the solution, it may help other developers in future, if you get stuck with this for a long time, you can ping me again, maybe I will have time and help you