feat!: migrate runtime to Vite 8 and native Rolldown optimizer options (#320) - #370
feat!: migrate runtime to Vite 8 and native Rolldown optimizer options (#320)#370thedavidweng wants to merge 6 commits into
Conversation
Upgrade react/react-dom and matching types to 19.2.x across core, demo, and the generated template. Update RefObject typings for the React 19 nullability contract. Co-authored-by: Davy <thedavidweng@users.noreply.github.com>
React 19 widens HTMLImageElement src to include Blob, which is incompatible with Next/fumadocs ImageProps. Keep string sources only for ImageZoom. Co-authored-by: Davy <thedavidweng@users.noreply.github.com>
Upgrade vite to 8.1.4 and @vitejs/plugin-react to 6.x. Replace deprecated optimizeDeps.esbuildOptions with optimizeDeps.rolldownOptions for virtual module exclusion. Fix website MDX ImageZoom typing exposed by the lockfile update. Co-authored-by: Davy <thedavidweng@users.noreply.github.com>
|
@thedavidweng is attempting to deploy a commit to the open-slide Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThis PR aligns runtime and generated workspaces with React 19 and Vite 8, updates nullable React ref typings, normalizes MDX image sources, and replaces esbuild virtual-module externalization with a tested Rolldown plugin. ChangesReact 19 and Vite 8 alignment
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/core/src/vite/config.test.ts (1)
13-38: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftExercise the actual dependency optimizer in this regression test.
The test calls
resolveIddirectly, so it would still pass if Vite/Rolldown ignored or misorderedoptimizeDeps.rolldownOptions.plugins. Add a temporary fixture that runs the optimizer or dev-server path and asserts thatvirtual:open-slide/slidesremains external without an unresolved-module failure. (vite.dev)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/vite/config.test.ts` around lines 13 - 38, Extend the test around createViteConfig to exercise Vite/Rolldown’s actual dependency-optimization or dev-server execution path using a temporary fixture, rather than invoking the virtual-externals plugin’s resolveId directly. Assert that importing virtual:open-slide/slides completes without an unresolved-module failure and remains external, while preserving the existing configuration assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/template/package.json`:
- Around line 14-20: Remove the direct dependency-version edits from the
template package.json and apply them through the approved template
source-of-truth or generation flow. If direct template edits are now
intentionally supported, update the prohibition rule instead; keep the generated
template output consistent with the chosen approach.
- Around line 14-20: Update the `@open-slide/core` dependency in
packages/cli/template/package.json from the old ^0.0.6 range to the released 1.x
major compatible with the React 19 and Vite 8 template, matching the major
version scheduled by the changesets and the current packages/core version.
---
Nitpick comments:
In `@packages/core/src/vite/config.test.ts`:
- Around line 13-38: Extend the test around createViteConfig to exercise
Vite/Rolldown’s actual dependency-optimization or dev-server execution path
using a temporary fixture, rather than invoking the virtual-externals plugin’s
resolveId directly. Assert that importing virtual:open-slide/slides completes
without an unresolved-module failure and remains external, while preserving the
existing configuration assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5902bafd-6b15-4de2-a4e2-a5419398a8a6
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
.changeset/react-19-alignment.md.changeset/vite-8-migration.mdapps/demo/package.jsonapps/web/components/mdx.tsxpackages/cli/template/package.jsonpackages/core/package.jsonpackages/core/src/app/components/inspector/inspect-overlay.tsxpackages/core/src/app/lib/use-click-page-navigation.tspackages/core/src/app/lib/use-wheel-page-navigation.tspackages/core/src/app/routes/slide.tsxpackages/core/src/vite/config.test.tspackages/core/src/vite/config.ts
| "react": "^19.2.7", | ||
| "react-dom": "^19.2.7" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/react": "^18.3.12", | ||
| "@types/react-dom": "^18.3.1", | ||
| "vite": "^5.4.10" | ||
| "@types/react": "^19.2.14", | ||
| "@types/react-dom": "^19.2.3", | ||
| "vite": "^8.1.4" |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '^(packages/cli/template/package\.json|packages/cli/template/open-slide\.config\.ts|packages/(cli|core)/package\.json|.*\.changeset|.)$' | sed -n '1,120p'
echo
echo "== package manifests relevant deps =="
for f in packages/cli/package.json packages/core/package.json packages/cli/template/package.json; do
if [ -f "$f" ]; then
echo "--- $f ---"
wc -l "$f"
sed -n '1,80p' "$f"
fi
done
echo
echo "== changesets =="
if [ -d .changeset ]; then
find .changeset -maxdepth 1 -type f -print -exec sh -c 'echo "--- {} ---"; sed -n "1,120p" "{}"' \;
else
echo "no .changeset directory"
fi
echo
echo "== git diff summary/name-status =="
git diff --stat
git diff --name-statusRepository: 1weiho/open-slide
Length of output: 5810
Move template package versioning out of direct edits.
packages/cli/template/package.json is covered by the rule prohibiting direct changes to packages/cli/template/**/{package.json,open-slide.config.ts}. Drop these direct edits and update the template via the approved source-of-truth/generation flow, or update that prohibition if it is obsolete.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/template/package.json` around lines 14 - 20, Remove the direct
dependency-version edits from the template package.json and apply them through
the approved template source-of-truth or generation flow. If direct template
edits are now intentionally supported, update the prohibition rule instead; keep
the generated template output consistent with the chosen approach.
Source: Path instructions
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
node -p "require('./packages/core/package.json').version"
node -p "require('./packages/cli/template/package.json').dependencies['`@open-slide/core`']"
rg -n '"`@open-slide/core`":' .changesetRepository: 1weiho/open-slide
Length of output: 289
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- package.json excerpt ---\n'
sed -n '1,80p' packages/cli/template/package.json
printf '\n--- changesets ---\n'
for f in .changeset/*.md; do
echo "### $f"
cat -n "$f"
done
printf '\n--- package manager config relevant files ---\n'
git ls-files | rg '(^|/)(package.json|pnpm-workspace.yaml|biome.json|tsconfig.*\.json)$' | head -80Repository: 1weiho/open-slide
Length of output: 246
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- packages/cli/template/package.json excerpt ---'
sed -n '1,80p' packages/cli/template/package.json
printf '%s\n' ''
printf '%s\n' '--- changesets ---'
for f in .changeset/*.md; do
echo "### $f"
cat -n "$f"
done
printf '%s\n' ''
printf '%s\n' '--- repo files relevant to package manifests/config ---'
git ls-files | rg '(^|/)(package.json|pnpm-workspace.yaml|biome.json|tsconfig.*\.json)$' || trueRepository: 1weiho/open-slide
Length of output: 2409
Publish and update the core major version in the template.
.changeset/react-19-alignment.md and .changeset/vite-8-migration.md both schedule a major @open-slide/core release, but packages/cli/template/package.json still depends on ^0.0.6 while packages/core/package.json is at 1.17.1. Generated workspaces will resolve the old compatibility core against the React 19/Vite 8 template; update this range to the released major built by the changesets.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/template/package.json` around lines 14 - 20, Update the
`@open-slide/core` dependency in packages/cli/template/package.json from the old
^0.0.6 range to the released 1.x major compatible with the React 19 and Vite 8
template, matching the major version scheduled by the changesets and the current
packages/core version.
|
Addressed CodeRabbit review: Template config.test.ts nitpick (skipped): The test validates the virtual-externals plugin contract by calling |
|
Context re #344 revert: #344 previously combined React 19 + Vite 8 in one PR and was reverted in #356 due to build/preview issues from virtual slide imports not being externalized during dep optimization. #344 used a static This PR uses a Rolldown plugin with a
See the comment on #318 for full details. |
Issue reference
Implements #320 (roadmap #318).
Stacking note — please read
This PR depends on #369 (React 19 alignment) —
@vitejs/plugin-react@6(the release that supports React 19) declaresvite: ^8.0.0as a peer, so React 19 and Vite 8 are coupled. This branch is based onmainand includes the React 19 commits from #369. The Vite 8–specific changes are the last 2 commits; the first 3 commits are identical to #369.For review, please focus on these files (Vite 8 only):
packages/core/src/vite/config.tspackages/core/src/vite/config.test.tspackages/core/package.json(theviteand@vitejs/plugin-reactlines)packages/cli/template/package.json(theviteline).changeset/vite-8-migration.mdOnce #369 merges, I will rebase this branch onto
mainand the diff will shrink to only the Vite 8 changes.Exact scope
Vite 8 + native Rolldown/Oxc optimizer migration only:
vite→^8.1.4in@open-slide/coreand CLI template@vitejs/plugin-react→^6.0.3optimizeDeps.esbuildOptionswithoptimizeDeps.rolldownOptionsmain+ React 19)Not enabled: experimental Full Bundle Mode, React Compiler, unrelated refactors.
Versions before and after
packages/corevite^5.4.10(resolved 5.4.21)^8.1.4(resolved 8.1.4)packages/core@vitejs/plugin-react^4.3.3^6.0.3vite^5.4.10^8.1.4optimizeDeps.esbuildOptions.pluginsoptimizeDeps.rolldownOptions.pluginsVitest still pulls transitive
vite@5.4.21(dev-only) until #322 upgrades Vitest.Why the old state was a problem
optimizeDeps.esbuildOptions.plugins, which Vite 8 only translates with partial support and marks deprecated for removal.Why these versions were chosen
@vitejs/plugin-react6.0.3 (peervite ^8, Oxc-based refresh path; React Compiler not enabled).rolldownOptionsper Vite 8 migration guide — no retained esbuild optimizer compatibility path.Breaking changes reviewed
optimizeDeps.esbuildOptionswith this package.Source changes required (Vite 8 only)
packages/core/src/vite/config.tsrolldownOptionsvirtual-externals pluginpackages/core/src/vite/config.test.tsesbuildOptions; virtual IDs marked externalpackages/core/package.json/ templateTests added or changed
packages/core/src/vite/config.test.ts(virtual externals + no esbuildOptions).Benchmark results
Same machine, Node 24.18.0, pnpm 10.17.0. Repository-measured (not upstream Rollup claims):
pnpm --filter demo buildManual validation results
On Node 24.18.0 with pnpm 10.17.0 (current
maintoolchain, plus the React 19 base):pnpm install✅pnpm format:check/pnpm lint/pnpm typecheck/pnpm test(306 passed) /pnpm build✅vite v8.1.4✅optimizeDeps.esbuildOptionsin core source ✅use-sync-external-store/shimremain inoptimizeDeps.include✅Known limitations
mainafter feat!: align core, demo, and CLI template on React 19 (#319) #369 merges.Prohibited workarounds — confirmation
Not used:
--force,--legacy-peer-deps, overrides/aliases,patch-package, Full Bundle Mode, React Compiler, blanket suppressions, prereleases, unrelated features.Summary by CodeRabbit
srcvalues to the zoom image component.