-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Make Vite work with pnpm #324
Comments
Nice~! Just tried out the preact template using pnpm@5. |
@lukeed hmm, can you provide a repro? It shouldn't require hoisting. |
@lukeed hmm interesting, I see the problem. Only tested vue and react templates... |
Ah, the prefresh plugin injects code that imports from |
Yeah, I haven't tested all the templates, but I only know of the flag because it's a bit of a common "problem" with pnpm. Most of the time it's dependencies not explicitly listing a package as a peer/direct dependency, and so (by default) pnpm is assuming it's free to nest items where they're said to be needed. Shameless hoisting flattens everything, allowing deps to access each other as siblings / from the common |
Actually in this particular case, I'm not sure what actually needs to be done since I'll make a suggestion over in the ticket you created. |
The injected code is injected into user source code and run in the context of the project, not as a file under |
Right, or under any directory scope that vite is looking at (or should be willing to look at) 👍 Thanks for quick responses |
Is your feature request related to a problem? Please describe.
pnpm is a nice package manager where packages are symlinked from a global store.
by default, it doesn't create flat node modules like npm or yarn v1 does, which is good, but many packages suffer from importing things that it didn't explicitly declare on
package.json
.in the case of vite however, it's about not being able to resolve the symlinks that pnpm creates.
see this repo for an example, it relies on
@intrnl/substate
, which depends onimmer
, but since we're using pnpm,immer
isn't in the top level directory.Describe the solution you'd like
vite being able to resolve dependencies of a package on a project that uses pnpm.
Describe alternatives you've considered
using
--shamefully-hoist
to hoist all packages and create a flat node modules, this doesn't seem like a good idea however.The text was updated successfully, but these errors were encountered: