Skip to content

fix(start-plugin-core): improve rollupOptions/rolldownOptions handling#6985

Merged
birkskyum merged 3 commits intomainfrom
fix(start-plugin-core)--vite-7-and-vite-8-compat
Mar 19, 2026
Merged

fix(start-plugin-core): improve rollupOptions/rolldownOptions handling#6985
birkskyum merged 3 commits intomainfrom
fix(start-plugin-core)--vite-7-and-vite-8-compat

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Mar 19, 2026

Fixes the SSR benchmark regression from

The bundlerOptionsKey detection ('rolldownVersion' in vite) evaluated against the plugin's own vite import, not the consumer's. In a pnpm workspace, start-plugin-core resolves vite@8 while the benchmarks resolve vite@7. The plugin set rolldownOptions, but Vite 7 only reads rollupOptions, causing Could not resolve entry module "solid/index.html".

Fix: instead of fragile detection logic, simply read/write both rollupOptions and rolldownOptions. Vite ignores the key it doesn't understand, so this is safe for both versions.

Reported in

Supersedes

Summary by CodeRabbit

  • Bug Fixes

    • Ensures bundler configuration works correctly with both Vite 7 and Vite 8, preventing build mismatches across environments.
  • Chores

    • Added a changeset entry and release metadata to document and publish the patch release.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4e3a79dc-b22e-49c4-95bb-46bb3e2b8163

📥 Commits

Reviewing files that changed from the base of the PR and between 198ed1a and c7ae408.

📒 Files selected for processing (1)
  • packages/start-plugin-core/src/plugin.ts

📝 Walkthrough

Walkthrough

Replaced dynamic bundler-option key detection with explicit assignments to both build.rollupOptions and build.rolldownOptions for client and server builds; removed obsolete isRolldown/bundlerOptionsKey exports from utilities. Added a changeset entry for a patch release.

Changes

Cohort / File(s) Summary
Release Metadata
.changeset/pretty-fans-eat.md
Added changeset entry documenting a patch release: "fix(start-plugin-core): fix Vite 7/8 compat for bundler options".
Bundler Options Refactor
packages/start-plugin-core/src/plugin.ts
Removed usage of a dynamic bundlerOptionsKey; now constructs a single bundlerOptions object and assigns the same reference to both build.rollupOptions and build.rolldownOptions for client and server builds. Preserves existing outDir/ssr and ensures server input fallback (serverAlias) remains when no bundler input is provided.
Utilities Cleanup
packages/start-plugin-core/src/utils.ts
Removed vite import and exported constants isRolldown and bundlerOptionsKey; kept getBundlerOptions(build) which still reads build?.rolldownOptions ?? build?.rollupOptions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • schiller-manuel

Poem

🐰✨ I hopped through code with nimble paws,
Swapped guesses for keys with careful laws.
Rollup, Rolldown — both set in tune,
So Vite can dance from seven to soon.
A tiny patch, a happy rune. 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes a general improvement to bundler options handling, but the actual fix addresses a critical Vite 7/8 compatibility issue where version detection was broken, causing entry module resolution failures. Update the title to reflect the core issue: 'fix(start-plugin-core): fix Vite 7/8 compat for bundler options' better captures the actual problem being solved.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix(start-plugin-core)--vite-7-and-vite-8-compat
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Mar 19, 2026

View your CI Pipeline Execution ↗ for commit c7ae408

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 9m 31s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 27s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-19 17:59:39 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

🚀 Changeset Version Preview

1 package(s) bumped directly, 3 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/start-plugin-core 1.167.1 → 1.167.2 Changeset
@tanstack/react-start 1.166.17 → 1.166.18 Dependent
@tanstack/solid-start 1.166.17 → 1.166.18 Dependent
@tanstack/vue-start 1.166.17 → 1.166.18 Dependent

@birkskyum birkskyum requested a review from Sheraff March 19, 2026 17:32
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 19, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@6985

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@6985

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@6985

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@6985

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@6985

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@6985

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@6985

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@6985

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@6985

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@6985

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@6985

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@6985

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@6985

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@6985

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@6985

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@6985

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@6985

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@6985

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@6985

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@6985

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@6985

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@6985

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@6985

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@6985

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@6985

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@6985

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@6985

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@6985

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@6985

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@6985

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@6985

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@6985

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@6985

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@6985

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@6985

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@6985

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@6985

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@6985

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@6985

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@6985

commit: c7ae408

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Bundle Size Benchmarks

  • Commit: 5accb6f86de3
  • Measured at: 2026-03-19T17:51:16.410Z
  • Baseline source: history:e5d23ecd5c28
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.61 KiB 0 B (0.00%) 276.07 KiB 76.12 KiB ▁▁▁▁▁██████
react-router.full 90.65 KiB 0 B (0.00%) 286.28 KiB 78.68 KiB ▁▁▁▁▁██████
solid-router.minimal 37.14 KiB 0 B (0.00%) 111.38 KiB 33.29 KiB ▁▁▁▁▁██████
solid-router.full 41.36 KiB 0 B (0.00%) 124.18 KiB 37.12 KiB ▁▁▁▁▁██████
vue-router.minimal 52.99 KiB 0 B (0.00%) 151.41 KiB 47.65 KiB ▁▁▁▁▁██████
vue-router.full 57.69 KiB 0 B (0.00%) 166.34 KiB 51.60 KiB ▁▁▁▁▁██████
react-start.minimal 101.99 KiB 0 B (0.00%) 324.08 KiB 88.20 KiB ▁▁▁▁▁██████
react-start.full 105.33 KiB 0 B (0.00%) 333.89 KiB 91.02 KiB ▁▁▁▁▁██████
solid-start.minimal 51.24 KiB 0 B (0.00%) 157.82 KiB 45.28 KiB ▁▁▁▁▁██████
solid-start.full 56.53 KiB 0 B (0.00%) 173.32 KiB 49.72 KiB ▁▁▁▁▁██████

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/start-plugin-core/src/plugin.ts (1)

248-259: Sound approach for cross-version compatibility.

Setting both keys is the correct solution since Vite ignores unknown properties. The inline comment clearly documents the rationale.

Consider extracting the shared input configuration to a variable to reduce duplication:

♻️ Optional: Extract shared input config
+              const clientInput = { input: { main: ENTRY_POINTS.client } }
               build: {
                 // Set both keys so this works with Vite 7 (rollupOptions)
                 // and Vite 8+ (rolldownOptions). Vite ignores unknown keys.
-                rollupOptions: {
-                  input: {
-                    main: ENTRY_POINTS.client,
-                  },
-                },
-                rolldownOptions: {
-                  input: {
-                    main: ENTRY_POINTS.client,
-                  },
-                },
+                rollupOptions: clientInput,
+                rolldownOptions: clientInput,
                 outDir: getClientOutputDirectory(viteConfig),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/start-plugin-core/src/plugin.ts` around lines 248 - 259, Duplicate
input blocks for rollupOptions and rolldownOptions should be extracted to a
shared constant to reduce duplication; create a variable (e.g., sharedInput = {
input: { main: ENTRY_POINTS.client } }) and use that variable for both
rollupOptions and rolldownOptions in the configuration where rollupOptions and
rolldownOptions are currently set so the behavior remains identical while
avoiding repeated object literals.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/start-plugin-core/src/plugin.ts`:
- Around line 248-259: Duplicate input blocks for rollupOptions and
rolldownOptions should be extracted to a shared constant to reduce duplication;
create a variable (e.g., sharedInput = { input: { main: ENTRY_POINTS.client } })
and use that variable for both rollupOptions and rolldownOptions in the
configuration where rollupOptions and rolldownOptions are currently set so the
behavior remains identical while avoiding repeated object literals.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b108a33d-6e17-4d0c-aed5-487af926578f

📥 Commits

Reviewing files that changed from the base of the PR and between 5accb6f and 198ed1a.

📒 Files selected for processing (3)
  • .changeset/pretty-fans-eat.md
  • packages/start-plugin-core/src/plugin.ts
  • packages/start-plugin-core/src/utils.ts
💤 Files with no reviewable changes (1)
  • packages/start-plugin-core/src/utils.ts

@birkskyum birkskyum changed the title fix(start-plugin-core): vite 7 and vite 8 compat fix(start-plugin-core): fix Vite 7/8 compat for bundler options Mar 19, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 19, 2026

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing fix(start-plugin-core)--vite-7-and-vite-8-compat (c7ae408) with main (e5d23ec)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (5accb6f) during the generation of this report, so e5d23ec was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Contributor

@Sheraff Sheraff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though i don't have the knowledge to say whether it's ok to use both keys at the same time i trust you on this.

I'm also working on moving the benchmark packages to vite 8.

@birkskyum birkskyum changed the title fix(start-plugin-core): fix Vite 7/8 compat for bundler options fix(start-plugin-core): improve rollupOptions/rolldownOptions handling Mar 19, 2026
@birkskyum birkskyum merged commit 0f585d5 into main Mar 19, 2026
17 checks passed
@birkskyum birkskyum deleted the fix(start-plugin-core)--vite-7-and-vite-8-compat branch March 19, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants