Repository navigation
feat(bolt-vite-react-ts): upgrade to vite 7 - #134
Open
sheepsteak wants to merge 3 commits into
Open
sheepsteak wants to merge 3 commits into
sheepsteak wants to merge 3 commits into
Conversation
Vite 8's Rolldown binding downloads on every WebContainer boot. Vite 7 stays on esbuild and Rollup, so ship that while the platform fix is open.
preview.getByText() never enters the preview iframe, and restoring the setup() snapshot drops the executable bit on vite's bin. Wait from Playwright's side and install in beforeEach instead.
|
|
@vitejs/plugin-react 5 is what the Vite 7 create-vite template ships. It still transforms with Babel. The Oxc plugin is v6, for Vite 8.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
bolt-vite-react-tsis on Vite 5 (vite ^5.4.2). Vite 8 is ready in #132, but inside WebContainer its first dev start is about 6.5s slower than Vite 5: Rolldown downloads@rolldown/binding-wasm32-wasion every new boot. That needs a platform fix before Vite 8 is a good default.Solution
Move the template to Vite 7.3.7, the latest 7.x. Vite 7 still bundles with esbuild and Rollup, so it does not hit the Rolldown WASM download. React 18, Tailwind 3 with PostCSS, ESLint, TypeScript, and
vite.config.tsstay as they are.@vitejs/plugin-reactmoves from^4.3.1to^5.1.1, the range in Vite's own Vite 7 React TypeScript template. The lockfile resolves 5.2.0. v5 still transforms with Babel. The Oxc plugin is v6, which is the Vite 8 line.Implementation Details
postcss ^8.5.6, so the lockfile resolvespostcss8.5.30. The declared range^8.4.35already allows that.^20.19.0 || >=22.12.0. WebContainer's Node 22.22.3 satisfies it.preview.getByText()andpreview.getByRole()from@webcontainer/testnever enter the iframe and do not wait, so the old test passed with no server running. The preview is cross-origin, so the wait runs through Playwright (page.frameLocatorplus awaitForVisiblebrowser command).setup(). Restoring that snapshot drops the executable bit onnode_modules/vite/bin/vite.js, andnpm run devthen fails withspawn vite EACCESwhilejshstill exits 0.beforeEachmounts and installs instead. Asset names are sorted before the snapshot compare, becausereaddirorder is not stable.Performance in WebContainer
Rerun after the
@vitejs/plugin-react5.2.0 bump. Vite 7 is faster than Vite 5 on dev and build in this batch. Install is slower. It does not have the Vite 8 cold-start cost from #132.npm installnpm run devto styled first rendernpm run build(wall clock)Method matches #132:
@webcontainer/testwith Vitest browser mode in headless Chromium on an Apple Silicon Mac, Oct 14 2026. Each run launches a fresh Chromium and boots a fresh WebContainer. 5 runs per version, alternating which one goes first. "Styled first render" is a Playwright wait inside the preview iframe until the starter text is present and Tailwind'sbg-gray-100is the computed background. Parentheses are min-max.Vite 7's five cold renders stayed between 2.33s and 2.79s. Vite 5 was wider: one install took 7.5s, one cold render took 5.5s, and one build took 6.5s wall (Vite reported 2.75s). An earlier run of this comparison, before the plugin bump (plugin-react 4.7.0), was tighter and the gap was smaller: cold styled render 2.35s vs 2.16s. Absolute times moved between the two runs, so the percentage gap here should not be read as the plugin upgrade itself being 30% faster. Neither side downloaded a Rolldown binding (0 of 5 runs). Vite 7 installed the esbuild and Rollup native packages, same as Vite 5, plus
@rolldown/pluginutilsonly. No WASI warning in dev or build output.Test plan
npm ci,npm run build,npm run typecheck,tsc --noEmit -p tsconfig.node.json, andnpm run lintinbolt-vite-react-tstest/bolt-vite-react-ts.test.tsin Chromium: production build, and the dev preview renders and updates on edit