-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Upgrade vite to 6.0.11 #51356
Upgrade vite to 6.0.11 #51356
Conversation
Waiting for gravitational/shared-workflows#310 before I can merge |
web/packages/build/vite/config.ts
Outdated
@@ -57,6 +57,7 @@ export function createViteConfig( | |||
const config: UserConfig = { | |||
clearScreen: false, | |||
server: { | |||
allowedHosts: true, |
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.
I wonder if we could use the target
variable instead of allowing all hosts?
I confirmed that HMR doesn't work when I comment out allowedHosts
completely and that it still works with this solution in place.
diff --git a/web/packages/build/vite/config.ts b/web/packages/build/vite/config.ts
index e2e9db9f1d..9521631ddf 100644
--- a/web/packages/build/vite/config.ts
+++ b/web/packages/build/vite/config.ts
@@ -54,10 +54,15 @@ export function createViteConfig(
}
}
+ const targetHostname =
+ target !== DEFAULT_PROXY_TARGET
+ ? new URL(`http://${target}`).hostname
+ : undefined;
+
const config: UserConfig = {
clearScreen: false,
server: {
- allowedHosts: true,
+ allowedHosts: targetHostname ? [`.${targetHostname}`] : [],
fs: {
allow: [rootDirectory, '.'],
},
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.
patch works for me, i appreciate the improvement. applied
Vite was updated to v6 quite recently actually. We made the decision to update it to v6 without waiting for electron-vite. #50617 (review) |
This will upgrade vite. I'm getting an "unmet dep" warning for electron-vite saying it expects a max of vite 5, however we are currently on the latest version of electron-vite so I don't think there is much we can do here. We have already been running vite 6+ for months now tho and electron-vite has been working fine so I think its ok to ignore for now.
BTW, I just got a notification an hour ago under an electron-vite issue that the beta of v3 is out which updates Vite compatibility to v6. |
This will upgrade vite. I'm getting an "unmet dep" warning for electron-vite saying it expects a max of vite 5, however we are currently on the latest version of electron-vite so I don't think there is much we can do here. We have already been running vite 6+ for months now tho and electron-vite has been working fine so I think its ok to ignore for now.
@ryanclark , i didn't have any issues with
localhost
and my non-localhost domain that I typically run so I didn't need to updateallowedHosts
, can you confirm?edit: confirmed we had a few users whos HMR didnt work without
allowedHosts
so Ive updated it