Respect Vite cache directory for emitted data
Clear and concise description of the problem
When running Vite with devtools enabled, various files are emitted to the node_modules/.rolldown directories. In some setups, e.g. with Yarn PnP, one does not necessarily have a node_modules directory, causing this to be created by this tooling. It would be nice to have a way to control where such assets are emitted.
Suggested solution
Leverage the cacheDir option from Vite as default value instead of node_modules, to allow for easy overriding.
Alternative
No response
Additional context
No response
Validations
- [x] Follow our Code of Conduct
- [x] Read the Contributing Guide.
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
rolldown-devtools isn't just for Vite (tsdown uses it too, for example), so tying it directly to Vite's cacheDir probably isn't the best way to go.
I think a better fix is to make the emit directory configurable. To do that, we'll need upstream support from Rolldown side. I'll go ahead and open an issue in Rolldown repo.