-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Cannot import local PNPM Workspace CommonJS package #11657
Comments
TL;DR, adding I've gone down a giant rabbit hole on this issue. This has to do with Apparently, Node.js doesn't have a very good history with symlinking (see nodejs/node#10107), and so that's what we're dealing with here, I believe. I wish this flag wasn't needed, because apparently there are some nasty side-effects. I'm pretty sure it only happens with CJS, as I originally set up a repro, and when I was using ESM, the symlink seemed to resolve correctly. Hope this helps. I feel your pain. I ran into this with a simple |
@jameschensmith Thank you for the swell reply. I'll give it a try and report back. |
That does appear to solve my conundrum @jameschensmith . I appreciate you taking the time to give a thoughtful response. For those finding this later on, I've updated my sandbox app to demonstrate the solution: https://stackblitz.com/edit/vitejs-vite-3mgrsj?file=apps%2Fapp1%2Fvite.config.js |
Another solution is to use https://pnpm.io/package_json#dependenciesmetainjected, see: https://stackblitz.com/edit/vitejs-vite-nzqcwp?file=apps/app1/package.json |
@lsdsjy Your solution helped in my case. |
In
So |
That did the trick for me, thanks! |
Describe the bug
Running
vite build
on a pnpm workspace application cannot prebundle and identify local package definitions/Repo structure
app1/vite.config.js
app1/package.json
util/package.json
Version:
"vite": ^4.0.4"
Reproduction
https://stackblitz.com/edit/vitejs-vite-3mgrsj?file=apps/app1/vite.config.js
Steps to reproduce
System Info
Used Package Manager
pnpm
Logs
Validations
The text was updated successfully, but these errors were encountered: