-
-
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
refactor: always use a cache directory #6415
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, and good catch about the certificate
@ArnaudBarre after a discussion with @dominikg, looks like global usage of vite may also be affected by this change. Would you split this PR in two so we can merge the cache dir fix before releasing 2.8? Thanks! |
Let me know about the decision for this change. Another option as suggested by @gluck is to allow to disable caching. This would be easy (adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM
I'm leaning towards allowing to disable caching. We're only going to be able to discuss this in the next team meeting (next Friday), I'll bring the topic there. |
@ArnaudBarre @dominikg we talked about this PR in the last team meeting, and we concluded that it is a good idea to always have a cache. The DX in Vite is heavily damaged without it, and we don't have a real use case at hand for justifying the complexity of allowing Vite to run without write access during dev. Vite can also be safely run globally if the cache is held at the root of the Vite project. @ArnaudBarre would you resolve the conflicts and confirm that this looks good to you? |
Just to be clear, this should land in a minor release due to this potential breaking change: |
What do you mean by "potentially this could be access from outside"? The idea is to merge it now that we are in the 2.8 beta period, so it will be included as part of a minor 👍🏼 |
I just mean it is now a required parameter and typescript would report an error, nothing more |
But |
export async function resolveHttpsConfig
^^^^^^ |
That function is only imported as an internal utility by other files, or maybe I'm not seeing where it is exported to the user |
Description
I'm currently working #4120 and I found that it adds some complexity to handle a nullable cacheDir. The only case it can happened is when there is no package.json detected, which seems a niche case. I suggest to use
.vite
as a cache directory in that case. We could also keep the default ofnode_modules/.vite
but it makes less sense in that case.Additional context
While looking for usage of cacheDir, I found that the caching of the certificate was dropped in #5514. I adding it back except if there was a reason to remove it (cc @patak-dev)
Note: This could technically be a breaking change for people using a global installation of Vite in projects that don't use a package manager.