Repository navigation
chore(build): upgrade vite to v8 and align the coupled toolchain - #46
Merged
Merged
Conversation
Bump vite ^5.4.11 -> ^8.1.4 and every vite-coupled dev dependency in lockstep. The plugin-react and css-injected-by-js majors peer on vite 8 exclusively, so the root toolchain moves as one: - @vitejs/plugin-react ^4 -> ^6 - vite-plugin-css-injected-by-js ^3 -> ^5 - vite-tsconfig-paths ^4 -> ^6 - vitest ^2 -> ^4 - @ladle/react 4 -> ^5 (keeps its own internal vite 6) - @types/node 20 -> ^22 (matches the CI Node 22 floor) The @types/node 20->22 bump surfaces a latent type error in the new locale helper: Array.at(-1) is `string | undefined`, which the newer lib types reject as an index key (TS2538). Index with a definite string instead -- runtime-identical, since split() always yields >=1 segment. Refs #45 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adopt the Rolldown/Oxc surface Vite 8 exposes:
- build.rollupOptions -> build.rolldownOptions (v8 deprecates the old
name; the multi-entry input + unhashed-embed.js entryFileNames carry
over unchanged)
- vite-plugin-css-injected-by-js v5 deprecates `styleId`; move to
`attributes: { id: 'sahaj-atlas-style' }` (host sites key off this
exact style-tag id, so it stays stable)
- __dirname -> import.meta.dirname (config runs as ESM under Node >=22)
- drop the long-commented experimental.renderBuiltUrl block
build.target is left at the Vite 8 default (Baseline Widely Available
2026: Chrome/Edge 111, Firefox 114, Safari 16.4) -- documented inline.
Closes #45
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Vite 8, @vitejs/plugin-react 6, and the rest of the bumped toolchain require Node ^20.19.0 || >=22.12.0. Record that floor in `engines.node` so local dev and the Cloudflare Pages build surface a too-old Node instead of failing opaquely mid-build (CI already runs Node 22). Refs #45 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
sahajatlas | 8946814 | Jul 14 2026, 11:46 AM |
Empty commit — no diff. Triggers a fresh push event so the two new Cloudflare Pages projects build against this PR. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying sahajatlas with
|
| Latest commit: |
5d56e1b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3fc5e063.sahajatlas.pages.dev |
| Branch Preview URL: | https://chore-vite-8-upgrade.sahajatlas.pages.dev |
Deploying sahajatlas-design with
|
| Latest commit: |
5d56e1b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://59cf7964.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://chore-vite-8-upgrade.sahajatlas-design.pages.dev |
…n one The Cloudflare Pages integration was swapped from atlas-legacy (syatlas.pages.dev) to two projects: sahajatlas (the app) and sahajatlas-design (the Ladle playground). The smoke job's stale CF_PROJECT=syatlas matched neither, so the URL picker fell back to the first *.pages.dev it found (the design/Ladle deploy) and ran the SPA smoke specs against the component playground — which has no id="syatlas" — and failed. Point CF_PROJECT at sahajatlas.pages.dev, and stop pick() falling back to an arbitrary deploy: with two projects per PR, only accept a URL for the configured project (else keep polling, then skip). Refs #45 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.
Summary
Upgrades Vite from 5.4.11 to 8.1.4 and moves every Vite-coupled dev dependency in lockstep — the
@vitejs/plugin-reactandvite-plugin-css-injected-by-jsmajors peer on Vite 8 exclusively, so the root toolchain can't go piecemeal. Vite 8 swaps the bundler core to Rolldown + Oxc; the widget's two build artifacts (the self-injectingembed.jsand the standalone SPA) are verified to behave exactly as before.vite.config.tsmigrated to the Vite 8 surface; the load-bearing unhashedembed.jsand thesahaj-atlas-styleinjected style tag are preservedembed.jsloads, styles inject, the map renders, and drawers navigateChanges
Dependency bumps (
package.json/pnpm-lock.yaml):vite@vitejs/plugin-reactvite-plugin-css-injected-by-jsvite-tsconfig-pathsvitest@ladle/react@types/nodevite.config.ts—build.rollupOptions→build.rolldownOptions;styleId→attributes: { id: 'sahaj-atlas-style' }(plugin v5 deprecatedstyleId);__dirname→import.meta.dirname; dropped a long-commentedexperimental.renderBuiltUrlblock.scripts/add-locale-key.mjs— the@types/node20→22 bump madeArray.at(-1)(typedstring | undefined) an invalid index key undercheckJs(TS2538); index with a definite string instead. Runtime-identical —split('.')always yields ≥1 segment.package.jsonengines.node— added^20.19.0 || >=22.12.0to record the Node floor this upgrade introduces (Vite 8 / plugin-react 6 require it), so a too-old Node fails loudly in local dev / the Pages build instead of opaquely..github/workflows/ci.yml+scripts/get-cloudflare-preview-url.mjs— repoint the smoke lane at the app's Pages project (CF_PROJECT→sahajatlas.pages.dev) after the Cloudflare integration was moved to two projects (sahajatlas= app,sahajatlas-design= Ladle playground). Also hardened the preview-URL picker to only accept the configured project's*.pages.dev(never fall back to an arbitrary deploy), so smoke can't accidentally run against the design/Ladle site.workspace→projectsfile here; specs use only stablevi.*APIs).Decision:
build.target— accept the Vite 8 defaultVite 8 raises the default browser floor to Baseline Widely Available 2026-01-01 (Chrome/Edge 111, Firefox 114, Safari 16.4), up from Vite 5's ~Chrome 87 / Safari 14. We accept the new default rather than pinning an older floor: the widget's headline feature is Mapbox GL v3, which already requires modern browsers, so the raised floor doesn't meaningfully change who can use the map. Documented inline in
vite.config.ts.Verification
pnpm lint(--max-warnings 0)pnpm typecheck(app + test projects)pnpm test:run— 153 tests / 22 files, 947ms (well under the edit-loop hook's ~5s budget)pnpm build— norollupOptionsdeprecation warning (config onrolldownOptions);dist/embed.jsemitted unhashed + hashedassets/*for the SPApnpm ladle:build— all stories render under Ladle 5pnpm installclean — no Vite peer-dependency warnings; single root Vite major;vaulpatch still appliesManual / visual verification
Ran the production build embedded against the local seeded SahajCloud backend (
pnpm preview, standalone entry +demo.html):<sahaj-atlas>custom element upgrades (:defined);embed.js(Rolldown bundle) executes with 0 console errors.<style id="sahaj-atlas-style">present with ~85 KB of valid Lightning-CSS-minified CSS (Raleway@import+.mapboxgl-maprules intact — Lightning CSS is the new default minifier)..mapboxgl-canvas2400×1524) with clustered event markers; localized country list resolves over HTTP./→/brazil, opens the region drawer, and the map camera frames the region.(Screenshots captured locally; the map+data render depends on a live SahajCloud client, so it's easiest to re-confirm on the PR's Cloudflare preview.)
Notes for reviewer
atlas-legacyPages image predated Vite 8's Node floor (that check failed on Vite 8 while passing onmain/Vite 5). The Cloudflare integration was moved to two projects on the current (Node 22) build image —sahajatlas(the app) andsahajatlas-design(the Ladle playground) — both of which now build and deploy under Vite 8. The smoke lane was repointed to the app project (see Changes). All checks green.CLAUDE.mdand.claude/docs/{architecture,mcp-setup}.mdstill describe the deploy as the singleatlas-legacyproject, anddemo.htmlhas a commentedsyatlas.pages.devexample URL — worth refreshing to the new two-project setup in a separate docs pass./code-review(high effort) and asecurity-reviewboth passed: the config migration preserves theembed.js+sahaj-atlas-stylecontract, supply-chain provenance checks out (all six bumps are the official-registrylatest, lockfile has no non-registry sources), and no secret/env reaches the bundle. Dismissed nits: caret vs exact pins on@ladle/react/@types/node(kept caret — matches the issue's targets + sibling bumps; lockfile pins exact), and the pre-existingassetInfoparam name.[email protected](< patched3.4.9, GHSA-vxr8-fq34-vvx9) — the widget's XSS defense inEventPanel, one patch behind. Pre-existing runtime dep, untouched by this build-tooling PR; worth its ownchore(deps)bump.resolve.tsconfigPaths: true) and prints an info line suggestingvite-tsconfig-pathscan be dropped. Left in per the issue (which bumps, not removes it); worth a small separate PR.entryFileNamesand the multi-entryinputcarry over unchanged underrolldownOptions(verified: Vite 8 types re-addinput/outputto the option, and the build emitsembed.jsunhashed).Closes #45
🤖 Generated with Claude Code