chore(deps): #3592177 Upgrade Vite to 8.3.3

AI-Generated: Yes. Used OpenCode (claude-opus-5-5).

⚠️ CI currently fails on a type-check because of the prerequisite tailwindcss-in-browser#26. This MR should be tested with tailwindcss-in-browser#26.

Prerequisite

  • tailwindcss-in-browser#26 needs a review first and adds the wasmBaseUrl option.
  • 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.
  • __dirname is now import.meta.dirname.
  • The optimizeDeps.exclude workaround for vite#8427 is removed for @swc/wasm-web and tailwindcss-in-browser. Vite 8.3.3 pre-bundles them with a working WASM URL.
  • Code editor: tailwindcss-in-browser loads its WASM through wasmBaseUrl in production builds. In dev mode, Canvas passes no wasmBaseUrl.

vite-compat

  • The shared Canvas Vite config uses Rolldown and Oxc options:
  • esbuild: { jsx: 'automatic' } is now oxc: { jsx: { runtime: 'automatic' } }. The output is identical.
  • build.rollupOptions is now build.rolldownOptions.
  • output.inlineDynamicImports: true is now output.codeSplitting: false.
  • ModuleInfo.isExternal is replaced with info.code === null.
  • The vite peer range includes ^8.

@drupal-canvas/cli

  • vite dependency is now ^8.3.3.
  • build.rollupOptions is now build.rolldownOptions in the local import and vendor builds.

@drupal-canvas/workbench

  • vite dependency is now ^8.3.3. @tailwindcss/vite and tailwindcss are now ^4.3.3, the first release with a Vite 8 peer range.
  • The preview payload build uses rolldownOptions, codeSplitting: false and the shared oxc option. Its output types come from Vite's build() instead of rollup.

@drupal-canvas/vite-plugin

  • The vite peer 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 external is now deps.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/runtime for the es2015 target. esbuild before inlined them. The CLI vendors these helpers like other packages, so they appear in manifest.vendor.
  • The Oxc minifier writes some strings with backticks. One vite-compat assertion 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 lists lightningcss_node-1.30.1.wasm.
    • In Canvas, run npm install <path-to>/tailwindcss-in-browser-<version>.tgz.
  1. Code editor (ui, tailwindcss-in-browser, @swc/wasm-web). Test with both the dev server and the production build.

    1. 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 checks tailwindcss-in-browser.
      • The browser console shows no WASM loading errors.
    2. Production: stop the dev server and run npm run --workspace=@drupal-canvas/ui build. Repeat the three checks above.
  2. Canvas editor and Astro hydration (ui, astro-hydration)

    1. With the production build, open a Canvas page in the editor. The preview renders and components can be added, edited and saved.
    2. View the published page. Interactive code components hydrate and respond to clicks.
  3. CLI (@drupal-canvas/cli)

    1. In a Canvas project, link the local CLI.
    2. Run npx canvas push. Components render on a Canvas page, including one that uses {...props}.
    3. The component's manifest.vendor lists @oxc-project/runtime helpers for components that use object spread.
  4. Workbench (@drupal-canvas/workbench, @drupal-canvas/vite-plugin)

    1. In a project that uses Vite 8, link the local Workbench and @drupal-canvas/vite-plugin.
    2. Run npm run dev. The Workbench preview renders, and Tailwind classes apply.
    3. Run npm run build. It succeeds without peer dependency warnings for vite.
  5. Storybook (ui)

    1. Run npm run --workspace=@drupal-canvas/ui storybook. Stories load.
  6. Headless preview height (@drupal-canvas/headless-host)

    1. Run the Canvas UI from this branch. Configure a headless frontend.
    2. Open a page add components that has viewport-relative height, for example min-h-screen to trigger iframe height change. Confirm height persists across refreshes.
Edited by Harumi Jang

Merge request reports

Loading
Loading