Monorepo projects share a cache
Description
When we have multiple vite projects in a monorepo project, I want them to use the same cache, meaning that they can reuse the existing cache when I set the cacheDir to the same path.
This can significantly increase the speed of "pre-bundling" when developing multiple projects at the same time.
Suggested solution
Use the same cacheDir , shared cache
Alternative
No response
Additional context
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 request the same feature to avoid creating a duplicate.
The cache currently contains metadata on per-project basis. I'm not sure sharing it is a good idea and might make the whole flow even complex and slower. Because we now need to know the entire monorepo dependencies in order to optimize them leading to slow startup, if we found dependencies dynamically the startup time will compound. And if we install a new dependency in one project, the whole cache needs to rebuild for other projects too.
The cache currently contains metadata on per-project basis. I'm not sure sharing it is a good idea and might make the whole flow even complex and slower. Because we now need to know the entire monorepo dependencies in order to optimize them leading to slow startup, if we found dependencies dynamically the startup time will compound. And if we install a new dependency in one project, the whole cache needs to rebuild for other projects too.
I think we'll find a good strategy to make that happen
@Dunqing do you mean you're willing to make a PR for the proposed feature?
@Dunqing do you mean you're willing to make a PR for the proposed feature?
When I'm free I'm willing to give it a try
Closing as I don't think this is possible without sacrificing startup/prebundling time. If there's a solution, feel free to send a PR directly. Thanks!