Skip to content
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

Merged
merged 2 commits into from
Jan 22, 2025
Merged

Upgrade vite to 6.0.11 #51356

merged 2 commits into from
Jan 22, 2025

Conversation

avatus
Copy link
Contributor

@avatus avatus commented Jan 22, 2025

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 update allowedHosts, can you confirm?

edit: confirmed we had a few users whos HMR didnt work without allowedHosts so Ive updated it

@avatus avatus added the no-changelog Indicates that a PR does not require a changelog entry label Jan 22, 2025
@avatus avatus requested a review from ryanclark January 22, 2025 14:55
@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from rosstimothy January 22, 2025 15:34
@avatus
Copy link
Contributor Author

avatus commented Jan 22, 2025

Waiting for gravitational/shared-workflows#310 before I can merge

@@ -57,6 +57,7 @@ export function createViteConfig(
const config: UserConfig = {
clearScreen: false,
server: {
allowedHosts: true,
Copy link
Member

@ravicious ravicious Jan 22, 2025

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, '.'],
         },

Copy link
Contributor Author

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

@ravicious
Copy link
Member

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.
@ravicious
Copy link
Member

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.

@avatus avatus enabled auto-merge January 22, 2025 16:49
@avatus avatus added this pull request to the merge queue Jan 22, 2025
Merged via the queue into master with commit 8925492 Jan 22, 2025
41 checks passed
@avatus avatus deleted the avatus/vite branch January 22, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants