-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
chore: backport fixes #917
Conversation
* feat: disable hmr when running in vitest by default * refactor: use vite server.hmr config instead that is set by vitest * fix: enforce hmr false, update changeset (cherry picked from commit f7409c8)
had to refactor the hmr one slightly due to the changes in v4 in the options, but spirit is identical |
const hot = | ||
!viteConfig.isProduction && | ||
!preResolveOptions.isBuild && | ||
viteConfig.server && |
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.
Something I just noticed but not a big deal to change. It looks like viteConfig.server
is always truthy, but this line implies otherwise, which could be confusing because we don't want to disable HMR if the server is not configured (HMR would've been enabled by default in dev)
*/ | ||
function enforceOptionsForHmr(options) { | ||
function enforceOptionsForHmr(options, viteConfig) { | ||
if (options.hot && viteConfig.server?.hmr === false) { |
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.
The ?.
seem unnecessary too.
these 2 patches are good to have in v3 too