-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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 crashes with an error when using yarn pnp + workspaces. #15910
Comments
It seems that yarn pnp doesn't work with |
Bummer. @sapphi-red should we disabled |
@patak-dev Yeah, I think we should disable it for now. |
Is there any point in always disabling cachedChecks for yarn pnp? Or only in cases where workspaces are used? |
I think we can disable it by default for pnp in general. People can opt-in if they want |
I ran into this issue yesterday, the specificity of this issue (pnp + workspaces + peerDependencies + vite 5.1) made this really difficult to reproduce and track down. I almost went crazy until I found this issue. Thank you guys for finding and fixing this, can' |
Describe the bug
When using Vite starting from version 5.1.0-beta.4 + yarn workspaces + pnp, Vite crashes with an error:
Error: Failed to scan for dependencies from entries: /Users/difuks/WebstormProjects/vite-workspaces-issue/app/index.html✘ [ERROR] Failed to resolve entry for package "shared". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-scan]
This error came from the "onResolve" callback registered here:
The plugin "vite:dep-scan" was triggered by this import
3:42:37 PM [vite] Pre-transform error: Failed to resolve entry for package "shared". The package may have incorrect main/module/exports specified in its package.json.
3:42:37 PM [vite] Internal server error: Failed to resolve entry for package "shared". The package may have incorrect main/module/exports specified in its package.json.
Plugin: vite:import-analysis
File: /Users/difuks/WebstormProjects/vite-workspaces-issue/app/index.ts
at packageEntryFailure (file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:47932:17)
at resolvePackageEntry (file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:47929:5)
at tryNodeResolve (file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:47699:20)
at Context.resolveId (file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:47462:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.resolveId (file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:50655:32)
at async TransformContext.resolve (file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:50346:23)
at async normalizeUrl (file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:65286:34)
at async file:///Users/difuks/WebstormProjects/vite-workspaces-issue/.yarn/unplugged/vite-virtual-e8245c2587/node_modules/vite/dist/node/chunks/dep-2l_yqaZo.js:65448:47
at async Promise.all (index 0)
This issue only occurs when specifying peerDependencies in a child workspace. The problems are associated with this commit. If I revert to the old behavior, then in the variable root I get:
/Users/difuks/WebstormProjects/vite-workspaces-issue/app
With the new behavior, the path turns out like this:
/Users/difuks/WebstormProjects/vite-workspaces-issue
Reproduction
https://github.com/DiFuks/vite-workspaces-issue
Steps to reproduce
remove shared peerDependencies
System Info
Used Package Manager
yarn
Logs
Show logs
Validations
The text was updated successfully, but these errors were encountered: