Skip to content

Upgrade Vite to v8#64600

Merged
ryanclark merged 14 commits intomasterfrom
ryan/vite8
Mar 17, 2026
Merged

Upgrade Vite to v8#64600
ryanclark merged 14 commits intomasterfrom
ryan/vite8

Conversation

@ryanclark
Copy link
Copy Markdown
Member

@ryanclark ryanclark commented Mar 13, 2026

This upgrades Vite to v8.

The build time of e goes from ~14s to ~7s, a 2x speed increase.

Rolldown (the new Rust version of rollup) was complaining about us including crypto, which was included by the crypto.randomUUID() polyfill. This method is supported in all major browsers, so I removed it.

Vite 8 now supports following paths in tsconfig.json itself, so we can remove the vite-tsconfig-paths plugin.

Will manually backport to v18 as I want to sync all the tooling dependencies first.

Manual Test Plan

Test Environment

Deployed to https://ryantest.cloud.gravitational.io

Test Cases

  • Ensure that Vite dev server (pnpm start-teleport-e) loads correctly and works as expected
  • Ensure that the built bundle loads correctly
    • Verify that the ace editor (editing a role) works correctly
  • Verify that Connect still builds and functions correctly
  • Verify that Storybook still runs as expected

@ryanclark ryanclark added the no-changelog Indicates that a PR does not require a changelog entry label Mar 13, 2026
@github-actions github-actions Bot requested a review from rudream March 13, 2026 11:09
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 13, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​rolldown@​1.0.0-rc.9951007899100
Updatednpm/​vite@​7.3.1 ⏵ 8.0.094 -21008299100
Updatednpm/​@​vitejs/​plugin-react-swc@​4.2.3 ⏵ 4.3.010010010095 +4100

View full report

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a463a1b40

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread web/packages/shared/components/TextEditor/ace.js
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnpm start-term fails with:
The electron vite main config output format must be "cjs" or "es".

I guess it's because alex8088/electron-vite#894?

@ryanclark
Copy link
Copy Markdown
Member Author

ryanclark commented Mar 13, 2026

Making this a draft whilst we iron out the edges (ace doesn't play nicely, audit generated docs needs fixing too)

Fixed these

@ryanclark ryanclark marked this pull request as draft March 13, 2026 11:22
@ryanclark ryanclark force-pushed the ryan/vite8 branch 2 times, most recently from b6db2ac to 8fae01b Compare March 13, 2026 12:15
@avatus
Copy link
Copy Markdown
Contributor

avatus commented Mar 13, 2026

crypto.randomUUID() polyfill. This method is supported in all major browsers,

this was added because crypto.randomUUID in the browser is only available in an HTTPS/secure context. i don't remember the usecase for it, but that was the reason for the polyfill

do you remember @rudream

@avatus
Copy link
Copy Markdown
Contributor

avatus commented Mar 14, 2026

disregard comment about the polyfill, i must be misremembering. it was only added for browser support #26368

@ryanclark ryanclark marked this pull request as ready for review March 17, 2026 09:27
@github-actions github-actions Bot requested a review from bl-nero March 17, 2026 09:28
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9935bcc427

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread web/packages/teleterm/electron.vite.config.mts
Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so long as someone from the Connect team approves

Copy link
Copy Markdown
Contributor

@gzdunek gzdunek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connect on macOS works fine.

Comment on lines +66 to +72
external: [
'electron',
/^electron\/.+/,
...builtinModules.flatMap(m => [m, `node:${m}`]),
...deps,
new RegExp(`^(${deps.join('|')})/.+`),
],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my testing, we can only externalize ['electron', 'node-pty'] and the app still works. However, it slightly increases the final DMG size (159286403 vs 158478273), so it seems reasonable to keep the current setup.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to test

@ryanclark ryanclark added this pull request to the merge queue Mar 17, 2026
Merged via the queue into master with commit 7753fa0 Mar 17, 2026
45 checks passed
@ryanclark ryanclark deleted the ryan/vite8 branch March 17, 2026 16:28
ryanclark added a commit that referenced this pull request Mar 17, 2026
* Upgrade Vite to v8

* Remove crypto.randomUUID polyfill

* Remove tsconfigPathsPlugin from everywhere

* pnpm format

* Update electron vite config with new options

* Fix the loading of ace editor

* rollupOptions -> rolldownOptions in gen-event-reference-config

* Import makeEvent directly to avoid including frontend code

* Fix electron config

* pnpm format

* Ensure ace extensions load after ace is loaded

* pnpm format

* Change external dependencies to only apply to main/preload

* Remove unused eslint directive
@ryanclark ryanclark mentioned this pull request Mar 17, 2026
5 tasks
@gzdunek gzdunek mentioned this pull request Apr 2, 2026
1 task
ryanclark added a commit that referenced this pull request Apr 8, 2026
* Upgrade Vite to v8

* Remove crypto.randomUUID polyfill

* Remove tsconfigPathsPlugin from everywhere

* pnpm format

* Update electron vite config with new options

* Fix the loading of ace editor

* rollupOptions -> rolldownOptions in gen-event-reference-config

* Import makeEvent directly to avoid including frontend code

* Fix electron config

* pnpm format

* Ensure ace extensions load after ace is loaded

* pnpm format

* Change external dependencies to only apply to main/preload

* Remove unused eslint directive
github-merge-queue Bot pushed a commit that referenced this pull request Apr 8, 2026
* Upgrade Vite to v8 (#64600)

* Upgrade Vite to v8

* Remove crypto.randomUUID polyfill

* Remove tsconfigPathsPlugin from everywhere

* pnpm format

* Update electron vite config with new options

* Fix the loading of ace editor

* rollupOptions -> rolldownOptions in gen-event-reference-config

* Import makeEvent directly to avoid including frontend code

* Fix electron config

* pnpm format

* Ensure ace extensions load after ace is loaded

* pnpm format

* Change external dependencies to only apply to main/preload

* Remove unused eslint directive

* Add pnpm-lock

* Update @swc/core and @swc/plugin-styled-components to match master

* pnpm format

* Remove `rolldown` dependency (#65330)

(cherry picked from commit fc19088)

* Remove HTTP2 headers

* Upgrade vite to 8.0.7

---------

Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com>
mmcallister pushed a commit that referenced this pull request Apr 28, 2026
* Upgrade Vite to v8

* Remove crypto.randomUUID polyfill

* Remove tsconfigPathsPlugin from everywhere

* pnpm format

* Update electron vite config with new options

* Fix the loading of ace editor

* rollupOptions -> rolldownOptions in gen-event-reference-config

* Import makeEvent directly to avoid including frontend code

* Fix electron config

* pnpm format

* Ensure ace extensions load after ace is loaded

* pnpm format

* Change external dependencies to only apply to main/preload

* Remove unused eslint directive
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 ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants