Repository navigation
Description
Summary
The repo builds with Vite 5.4.11; current stable is Vite 8.1.4 — a two-major jump whose headline change is swapping the bundler core (Rollup + esbuild → Rolldown + Oxc). Upgrade vite and every Vite-coupled dev dependency in lockstep, migrate vite.config.ts off the deprecated rollupOptions surface, and verify the two build artifacts host sites depend on — the self-injecting widget bundle (embed.js) and the standalone SPA — behave exactly as before.
Current state
| Package | Current | Target | Constraint |
|---|---|---|---|
vite |
^5.4.11 | ^8.1.4 | engines Node ^20.19.0 || >=22.12.0 |
@vitejs/plugin-react |
^4.3.4 | ^6.0.3 | peers on vite ^8.0.0 only |
vite-plugin-css-injected-by-js |
^3.5.2 | ^5.0.1 | peers on vite >8.0.0-0 only |
vite-tsconfig-paths |
^4.3.2 | ^6.1.1 | peer vite * |
vitest |
^2 (2.1.9) | ^4.1.10 | peer vite ^6 || ^7 || ^8 |
@ladle/react |
4.1.2 | ^5.1.1 | bundles its own Vite 6 — independent of root Vite |
@types/node |
20.5.7 | ^22.12.0 | Vite 8 peer range; CI runs Node 22 |
The plugin-react and css-injected-by-js majors peer on Vite 8 exclusively, so the root toolchain can't be upgraded piecemeal — one PR, all in lockstep. Ladle stays decoupled (its Vite 6 is internal).
Proposed changes
1. vite.config.ts migration
build.rollupOptions→build.rolldownOptions(deprecated alias in v8). Verify under Rolldown that the multi-entry input (main: index.html,widget: src/Widget.tsx) and theoutput.entryFileNamescallback still emit an unhashedembed.jsfor the widget entry and hashedassets/*for the SPA. Theembed.jsname is load-bearing — host sites hardcode its URL.- Replace
__dirnamewithimport.meta.dirname(config executes as ESM since Vite 7's ESM-only distribution; Node ≥20.19 supports it). - Drop the commented-out
experimental.renderBuiltUrlblock while in there.
2. Walk the v6 → v7 → v8 migration guides; repo-relevant items
- v7: ESM-only dist (repo is
type: module— fine); Node 18 dropped (CI + local run Node 22 — fine). - v8: Lightning CSS now minifies CSS by default (was esbuild) — diff the emitted widget CSS, since
cssCodeSplit: true+vite-plugin-css-injected-by-js(styleId: 'sahaj-atlas-style',relativeCSSInjection) is the embedding mechanism; CJS default-import interop is now consistent between dev and build — sanity-check CJS deps (axios,qs,luxon,dompurify) in both modes; Oxc replaces esbuild transforms (repo passes no customesbuildoptions and uses no decorators — should be transparent). - Default browser targets rise to Baseline Widely Available 2026-01-01 (Chrome/Edge 111, Firefox 114, Safari 16.4). The widget embeds on third-party host sites whose audiences we don't control — make an explicit call: accept the new floor or pin a lower
build.target. Record the decision in the PR.
3. Vitest 2 → 4
Both configs (vitest.config.ts, vitest.smoke.config.ts) are small (globals, node env, include/exclude, retry) so this is mostly the version bump, but walk the Vitest 3 + 4 migration notes (workspace→projects, mock API changes) and confirm the unit lane stays fast (< ~5 s) — the PostToolUse edit-loop hook depends on it.
4. Ladle 4 → 5
Bump @ladle/react to ^5.1.1. .ladle/vite.config.ts only adds the @/ alias, but note it does import { defineConfig } from 'vite' — that type now comes from root Vite 8 while Ladle executes the config under its bundled Vite 6. Keep the config a plain compatible object (or import Ladle's own types) and verify pnpm ladle + pnpm ladle:build render all stories.
5. Out-of-repo: Cloudflare Pages build image
pnpm build on Cloudflare Pages (project atlas-legacy) must run on Node ≥ 20.19 / 22.12. If the project's build image defaults to an older Node, set NODE_VERSION in the dashboard. Confirmed by the PR preview deploy succeeding.
Acceptance criteria
-
pnpm installresolves cleanly with no Vite peer-dependency warnings; root has a single Vite major (Ladle's internal Vite 6 is the only other instance) - CI gate passes:
pnpm lint && pnpm typecheck && pnpm test:run && pnpm build && pnpm ladle:build - Build output has no
rollupOptionsdeprecation warnings (config migrated torolldownOptions) -
dist/still contains unhashedembed.jsplus hashedassets/*for the SPA entry - Widget embed verified via
demo.html:embed.jsloads, styles are JS-injected (sahaj-atlas-styletag present), map renders and drawers navigate - Standalone
pnpm devandpnpm previewwork, including locale JSON loading over HTTP - Smoke lane passes against the Cloudflare preview (Pages Node version bumped first if required)
- Explicit decision recorded on
build.targetvs. the new Baseline browser floor
Files affected
package.json,pnpm-lock.yamlvite.config.tsvitest.config.ts,vitest.smoke.config.ts(expected no-op beyond the bump).ladle/vite.config.ts(verify; possibly retypedefineConfigimport)
References
- Vite 8 announcement: https://vite.dev/blog/announcing-vite8
- Migration guides: https://vite.dev/guide/migration (v8), https://v7.vite.dev/guide/migration, https://v6.vite.dev/guide/migration
- Vitest migration: https://vitest.dev/guide/migration
- Ladle v5 release notes: https://github.com/ladle/ladle/releases
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
fix(ci): point the smoke lane at the app Pages project, not the desig…