-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Doesn't resolve modules with pnpm
#67
Comments
Caveat: I'm totally unfamiliar with pnpm. Thanks for the simple repro case! It was very straightforward to reproduce the issue. I'm just reading up on this tool now. I noticed that the FAQ (https://pnpm.js.org/en/faq) says this:
I can verify that if you follow your instructions and do node_modules/chalk/source/index.js:2:27: error: Could not resolve "ansi-styles"
const ansiStyles = require('ansi-styles');
~~~~~~~~~~~~~
node_modules/chalk/source/index.js:3:59: error: Could not resolve "supports-color"
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
~~~~~~~~~~~~~~~~ However, if I do Does this mean that, as the FAQ says, this is an error in the dependency? Sorry if that's not the case. I've never used pnpm before. Also: Is there a description of the changes to the module resolution algorithm that I'd need to use to support pnpm? Node has a great reference for its module resolution algorithm, for example: https://nodejs.org/api/modules.html#modules_all_together. |
Thanks for the answer @evanw! The |
@evanw seems like the issue is that esbuild does not use the real location of the files when resolving dependencies. The real location of chak is not at
|
That's very helpful! It'll probably be a little tricky to fix this without regressing performance. It looks like the naive approach is a big performance hit. I'll have to figure out a caching strategy. It seems like this doesn't work in Parcel either. I believe parcel-bundler/parcel#1125 is the corresponding issue. |
Just gave fixing it a shot. The module resolution algorithm should now return the real location instead of the symlink location. Please let me know if that works for you or not. |
The fix works! Thanks a lot! |
Unfortunately, this does break |
Hi @evanw , I just tried this on a windows machine (0.6.5, installed from |
pnpm
is not using hoisting, but always nests thenode_modules
.It seems like this doesn't work with
esbuild
.Here is a simple repro: https://github.com/timsuchanek/esbuild-pnpm
The text was updated successfully, but these errors were encountered: