Loading
chore(deps): #3592177 Upgrade Vite to 8.3.3
AI-Generated: Yes. Used OpenCode (claude-opus-5-5).
Prerequisite
- tailwindcss-in-browser#26 needs a review first and adds the
wasmBaseUrloption. - To test: use that PR's branch of tailwindcss-in-browser. See the testing instructions below.
- Before this MR is merged, tailwindcss-in-browser needs a release that includes tailwindcss-in-browser#26 and this MR needs to update to the new release of tailwindcss-in-browser if we go forward with that solution.
Changes
Upgrades Vite to 8.3.3 across the Canvas monorepo. Vite 8 replaces Rollup with Rolldown and esbuild with Oxc.
All workspaces
- Vite 8.3.3. The root package.json adds vite ^8.3.3 as a dev dependency.
ui
- Dependencies: Vitest 4, @vitejs/plugin-react 5, and Storybook 10, because Storybook 8 and 9 do not support Vite 8.
- Storybook 10: @storybook/test, blocks, addon-essentials and addon-interactions are part of core. Stories import fn from storybook/test.
- Vite config:
- build.rollupOptions is now
build.rolldownOptions. __dirnameis nowimport.meta.dirname.- The
optimizeDeps.excludeworkaround for vite#8427 is removed for@swc/wasm-webandtailwindcss-in-browser. Vite 8.3.3 pre-bundles them with a working WASM URL. - Code editor:
tailwindcss-in-browserloads its WASM throughwasmBaseUrlin production builds. In dev mode, Canvas passes nowasmBaseUrl.
vite-compat
- The shared Canvas Vite config uses Rolldown and Oxc options:
esbuild: { jsx: 'automatic' }is nowoxc: { jsx: { runtime: 'automatic' } }. The output is identical.build.rollupOptionsis nowbuild.rolldownOptions.output.inlineDynamicImports: trueis nowoutput.codeSplitting: false.ModuleInfo.isExternalis replaced withinfo.code === null.- The
vitepeer range includes^8.
@drupal-canvas/cli
vitedependency is now^8.3.3.build.rollupOptionsis nowbuild.rolldownOptionsin the local import and vendor builds.
@drupal-canvas/workbench
vitedependency is now^8.3.3.@tailwindcss/viteandtailwindcssare now^4.3.3, the first release with a Vite 8 peer range.- The preview payload build uses
rolldownOptions,codeSplitting: falseand the sharedoxcoption. Its output types come from Vite'sbuild()instead ofrollup.
@drupal-canvas/vite-plugin
- The
vitepeer range includes^8.
@drupal-canvas/headless-host
- The host restores the pre-probe iframe height when the iframe loads a new document. Before, a draft refresh during a height probe left the iframe at the probe height, and the host ignored later height reports. The page was cut off in the editor. This race also occurs on
1.x.
drupal-canvas
- tsdown
externalis nowdeps.neverBundle.
astro-hydration, headless-astro, headless-tanstack-start
- astro-hydration: build.rollupOptions is now build.rolldownOptions
- headless-astro, headless-tanstack-start: dev dependency vite` is now ^8.3.3. Peer ranges are unchanged.
Changesets
- Patch:
@drupal-canvas/cli,@drupal-canvas/workbench,@drupal-canvas/headless-host.\ - Minor:
@drupal-canvas/vite-plugin.
Output differences
- Oxc imports object spread and rest helpers from
@oxc-project/runtimefor thees2015target. esbuild before inlined them. The CLI vendors these helpers like other packages, so they appear inmanifest.vendor. - The Oxc minifier writes some strings with backticks. One
vite-compatassertion is updated to match.
Testing instructions
Setup (required for all sections)
- Run npm i
- Install the tailwindcss-in-browser#26 branch as a tarball. Do not use
npm link. Vite does not pre-bundle a linked package, so a symlink does not test the optimizeDeps change in section 4.- In tailwindcss-in-browser, run npm run build, then npm pack.
- Run
tar -tzf tailwindcss-in-browser-*.tgz | grep wasm. It listslightningcss_node-1.30.1.wasm. - In Canvas, run
npm install <path-to>/tailwindcss-in-browser-<version>.tgz.
-
Code editor (
ui,tailwindcss-in-browser,@swc/wasm-web). Test with both the dev server and the production build.- Dev: run
npm run --workspace=@drupal-canvas/ui drupaldev. Open a code component in the Canvas code editor.- The component JavaScript compiles and the preview renders. This checks
@swc/wasm-web. - Add a Tailwind class, for example
bg-red-500. The preview applies it. This checkstailwindcss-in-browser. - The browser console shows no WASM loading errors.
- The component JavaScript compiles and the preview renders. This checks
- Production: stop the dev server and run
npm run --workspace=@drupal-canvas/ui build. Repeat the three checks above.
- Dev: run
-
Canvas editor and Astro hydration (
ui,astro-hydration)- With the production build, open a Canvas page in the editor. The preview renders and components can be added, edited and saved.
- View the published page. Interactive code components hydrate and respond to clicks.
-
CLI (
@drupal-canvas/cli)- In a Canvas project, link the local CLI.
- Run
npx canvas push. Components render on a Canvas page, including one that uses{...props}. - The component's
manifest.vendorlists@oxc-project/runtimehelpers for components that use object spread.
-
Workbench (
@drupal-canvas/workbench,@drupal-canvas/vite-plugin)- In a project that uses Vite 8, link the local Workbench and
@drupal-canvas/vite-plugin. - Run
npm run dev. The Workbench preview renders, and Tailwind classes apply. - Run
npm run build. It succeeds without peer dependency warnings forvite.
- In a project that uses Vite 8, link the local Workbench and
-
Storybook (ui)
- Run
npm run --workspace=@drupal-canvas/ui storybook. Stories load.
- Run
-
Headless preview height (
@drupal-canvas/headless-host)- Run the Canvas UI from this branch. Configure a headless frontend.
- Open a page add components that has viewport-relative height, for example
min-h-screento trigger iframe height change. Confirm height persists across refreshes.
Edited by Harumi Jang