-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
vite file serving allow list doesn't work with yarn berry + global cache #6022
Comments
Reproduce instructions: In a clean directory:
|
If you simply add the global yarn cache to vite's allow list then you're also opening up dependencies that were not specified in This is a potential security issue though. Imagine a local package that was not published on npm contains sensitive data & someone runs the dev server with The "correct" solution seems to be to enumerate every transitive dependency specified in |
After digging through the astro code I can't find anywhere where If so this is really a vite issue, not an astro one. For anyone else who encounters the same issue, a workaround is to put in your
|
Astro doesn't change the I'm not sure how this can be fixed unless yarn exposes the directory under Thanks for the report. I'll close this for now as there's not much Astro can do at the moment. |
What version of
astro
are you using?2.0.2
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn 3.x
What operating system are you using?
Mac
Describe the Bug
Background: One of the benefits of yarn 2+ (yarn berry) is pnp mode: the ability to avoid installing everything in
node_modules
. Instead npm modules are downloaded into a shared global cache and the nodejs module loader is patched to load them from the global cache.yarn install
s are usually much faster, and there is no massivenode_modules
directory.Previously the astro advice (#3450) was to use
nodeLinker: node-modules
which causes yarn to not use pnp mode, and instead install everything innode_modules
likenpm
.With #4842 this is no longer required.
However that patch didn't fix everything: when running the dev server vite now issues errors like:
It appears that the default
vite.server.fs.allow
from astro doesn't include the global yarn cache.(This isn't limited to
hmr.js
; it also happens with any package whose contents are directly served -- eg using@fontsource
as recommended in the docs)Link to Minimal Reproducible Example
https://gist.github.com/levic/b8a31b70163329617f0338c6af0a975b
Participation
The text was updated successfully, but these errors were encountered: