Skip to content
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

Do not hard-code node_module as cache directory #2523

Closed
marvinruder opened this issue Sep 5, 2022 · 3 comments
Closed

Do not hard-code node_module as cache directory #2523

marvinruder opened this issue Sep 5, 2022 · 3 comments

Comments

@marvinruder
Copy link

marvinruder commented Sep 5, 2022

In #2457, it was introduced to write to the hard-coded folder node_modules/.cache/esbuild in certain cases when using yarn. However modern yarn workflows (https://yarnpkg.com/features/pnp) no longer use node_modules folder, e.g. in favor of .yarn/cache. So there is no node_modules folder in those projects, and also no reason to create one with that name. It would be great to be able to choose a different folder for storing the cached binary in those cases, possibly inside .yarn or something like .esbuild.

@marvinruder marvinruder closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2022
@bapmrl
Copy link

bapmrl commented Sep 8, 2022

Hello,

Why has this been closed? I'd also love to be able to configure the directory where the esbuild binary gets copied (as I'm using Yarn's Plug'n'Play feature and don't have any node_modules directories).

Thank you,

@evanw
Copy link
Owner

evanw commented Sep 8, 2022

I’m not sure exactly why it was closed since I didn’t close it. But one reason to keep things the way they are is because the official Yarn docs themselves say to use node_modules/.cache as the canonical location: https://yarnpkg.com/advanced/rulebook#packages-should-never-write-inside-their-own-folder-outside-of-postinstall.

Another possible solution could be for esbuild to mark all of esbuild’s packages as preferUnplugged: true. Then no copying would be necessary at all.

@davidkarlsson
Copy link

I'm also not very fond of esbuild creating a node_modules/.cache/esbuild folder. Thanks to the wonders of Yarn PnP I hadn't seen a node_modules folder for a long time until today when it was suddenly back after having updated esbuild to 0.15.10.

Isn't esbuild unplugged implictly anyway because it contains a postinstall script as https://yarnpkg.com/advanced/lexicon#unplugged-package says it should be? I can see both esbuild and esbuild-windows-64 in my .yarn/unplugged folder so I think it is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants