-
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
esbuild doesn't follow symlinks #698
Comments
I actually can't reproduce this issue outside my project so I'm closing this issue until I can figure it out. |
Are there any plans to support something similar to the |
@ricklamers I tested this thoroughly last week and can confirm that esbuild follows relative softlinks correctly, at least on version In my monorepo I have a shared dir that sits in the root of the repo. The path would be |
@whaaaley the symlinks are being correctly resolved. The problem however is the follow (citing node.js docs here):
https://nodejs.org/api/cli.html#cli_preserve_symlinks So a flag for |
@ricklamers Ah you're right, my bad. I agree with you. In my project I had to inline the modules I was importing from the symlinked location, which was a bit ugly. A flag for this would be nice. |
@evanw should I open a separate issue for this? |
Sure. Please ideally provide a reproducible test case demonstrating the problem. |
I think this was changed because of one of these issues #154 or #310. However, this makes it really difficult to use esbuild with monorepos and it's unexpected because other tools follow symlinks.
I know this has been a hot issue with node's module resolution. See nodejs/node-eps#46 and the threads linked there. The argument for resolving symlinks has to do with supporting alternative package managers like pnpm. The argument against this is that it's not what other languages do as mentioned here nodejs/node#3402 (comment).
From what I understand the solution they reached was adding
--preserve-symlinks
and--preserve-symlinks-main
because they were in too deep to revert something like that. Or at least that's what they were claiming. Info on the flags here: https://nodejs.org/dist/latest-v14.x/docs/api/cli.html#cli_preserve_symlinksIn any case, my preference would be to preserve the symlink location. This is what symlinks were intended for and messing with them because of a few unofficial package managers seems wrong. Symlinks should behave as if the files/directory is actually there where the link is. Support for alternative package managers could be solved through a plugin instead.
Thanks for reading 👋
EDIT: This actually might not be the issue I'm having. Looks like symlinks work when they're within the project but as soon as they're linked outside the project directory symlinks break.
The text was updated successfully, but these errors were encountered: