-
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
Bundling fails without read permission to parent directories #938
Comments
I did notice something similar for output file paths. Here's a contrived example for demonstration purposes:
Side note... not crazy about the need for the extra typing needed to disable the verbose output:
Although I'd prefer the way esbuild used to work with UNIX-style "silent by default except for errors", might you consider having |
@kzc Don't use
|
@heyheyhello I prefaced my comment with:
|
Yeah and your contrived example is great to show the |
It was a side note based on the previous command. Here's a simpler example: Compare the length of this command:
to this one:
Once anyone has used esbuild once they never need to see the verbose output again and will have to type |
I think the use case you're imagining is very different than a lot of developers... Personally I want to see the build size everytime I build. When esbuild used to not show it the first thing I'd do after was an |
Thanks for reporting this issue. I'm aware of the issue and it's come up once before here: #803 (comment). I gave fixing it a quick try then but I was unable to reproduce the issue myself (didn't try too hard at the time) and gave up. Even your repro instructions fail to cause the issue for me. I can give it another shot though. The underlying reason is that esbuild makes heavy use of caching to avoid huge performance issues with node's path resolution algorithm. The algorithm is inherently inefficient because it involves making potentially hundreds of file system queries to resolve each individual import path (check all implicit file extensions * check My implementation caches file system syscalls in the resolver to try to make this as efficient as possible. The cache in the resolver currently works by ensuring the parent directory is cached before caching a child directory, but that doesn't work if a parent directory is off-limits. Without investigating this myself first, I'm not totally sure what would need to change about the caching strategy to fix this problem correctly. But I agree that it should be fixed. |
Cool, thanks for the explanation! @ Repro: For context, the commands above were run on Ubuntu 20.10, several times with the unreadable directory at different levels above the root, and always caused the issue for me. |
Hi, I am trying to use esbuild on an Ubuntu VPS where my
$HOME
directory is/usr/home/<USER>
, but I don't have read permission to the parent folder/usr/home
.This causes bundling to fail with
Cannot read directory ... permission denied
The error can be reproduced on any machine by mimicking the permissions layout:
Output:
From my (ignorant) viewpoint it seems unnecessary to read anything above the package root when resolving node modules, so I thought esbuild could possibly prevent tripping up in this situation. (E.g. Webpack bundles without errors in the same situation.)
The text was updated successfully, but these errors were encountered: