vite
vite copied to clipboard
Failed to resolve workspace dependency present in 'optimizeDeps.include'
Describe the bug
It seems that optimizeDeps.include is able to resolve only dependencies that are defined in the root workspace and its package.json. In other words, you can optimize deps only from a single workspace.
After opening the repro, you will see this warning:
Failed to resolve dependency: jquery, present in 'optimizeDeps.include'
while react gets optimized just fine because it's in the root workspace.
Expectation
optimizeDeps.include should work for all dependencies across multiple workspaces. If these deps can be later resolved and served by Vite anyway I don't see a reason why they couldn't be prebundled as well.
Reproduction
https://stackblitz.com/edit/node-whfueq?file=app%2Fpackage.json
System Info
Stackblitz
Used Package Manager
pnpm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.