Skip to content

fix(start): preserve resolved virtual module ids#7844

Merged
schiller-manuel merged 1 commit into
mainfrom
fix-7725
Jul 18, 2026
Merged

fix(start): preserve resolved virtual module ids#7844
schiller-manuel merged 1 commit into
mainfrom
fix-7725

Conversation

@schiller-manuel

@schiller-manuel schiller-manuel commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

fixes #7725

Summary by CodeRabbit

  • Bug Fixes
    • Preserved exact virtual module identities (including prefixes and query variants) during compilation and loading.
    • Improved server-function lookup handling using dedicated query-flag detection and helpers.
    • Ensured module IDs that differ only by query parameters are treated as distinct.
  • Tests
    • Added unit tests for query-flag module ID helpers and distinct virtual identity behavior.
    • Added an end-to-end route/build scenario for the server-function import-protection case.

@nx-cloud

nx-cloud Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 1b8c994

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

☁️ Nx Cloud last updated this comment at 2026-07-18 17:42:28 UTC

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 839e64f7-b889-4458-a32b-7891928992ee

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc436c and 1b8c994.

📒 Files selected for processing (12)
  • .changeset/tidy-pandas-load.md
  • e2e/react-start/import-protection/src/routes/issue-7725.tsx
  • e2e/react-start/import-protection/src/violations/issue-7725-server-fn-factory.ts
  • e2e/react-start/import-protection/vite.config.ts
  • packages/start-plugin-core/src/import-protection/constants.ts
  • packages/start-plugin-core/src/start-compiler/compiler.ts
  • packages/start-plugin-core/src/start-compiler/utils.ts
  • packages/start-plugin-core/src/vite/import-protection-plugin/plugin.ts
  • packages/start-plugin-core/src/vite/module-id.ts
  • packages/start-plugin-core/src/vite/start-compiler-plugin/plugin.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/vite/module-id.test.ts
💤 Files with no reviewable changes (1)
  • packages/start-plugin-core/src/import-protection/constants.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • .changeset/tidy-pandas-load.md
  • e2e/react-start/import-protection/src/violations/issue-7725-server-fn-factory.ts
  • e2e/react-start/import-protection/src/routes/issue-7725.tsx
  • packages/start-plugin-core/src/start-compiler/utils.ts
  • packages/start-plugin-core/tests/vite/module-id.test.ts
  • e2e/react-start/import-protection/vite.config.ts
  • packages/start-plugin-core/src/vite/import-protection-plugin/plugin.ts
  • packages/start-plugin-core/src/start-compiler/compiler.ts

📝 Walkthrough

Walkthrough

The Start compiler now preserves exact Vite module IDs, including virtual prefixes and query parameters, while server-function lookup flags are managed independently. New utilities, regression tests, and a build-only import-protection reproduction cover the updated behavior.

Changes

Module identity preservation

Layer / File(s) Summary
Module ID utilities and compiler resolution
packages/start-plugin-core/src/vite/module-id.ts, packages/start-plugin-core/src/start-compiler/compiler.ts, packages/start-plugin-core/src/start-compiler/utils.ts, packages/start-plugin-core/tests/vite/module-id.test.ts
Adds query-flag helpers, preserves existing ID formatting, and updates compiler identity and cycle tracking to use raw module IDs.
Vite plugin integration and regression coverage
packages/start-plugin-core/src/vite/start-compiler-plugin/plugin.ts, packages/start-plugin-core/src/vite/import-protection-plugin/plugin.ts, packages/start-plugin-core/src/import-protection/constants.ts, packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
Preserves resolved virtual IDs during loading, selectively strips compiler lookup flags, and detects lookup variants through query parsing.
Build reproduction and release metadata
e2e/react-start/import-protection/src/routes/issue-7725.tsx, e2e/react-start/import-protection/src/violations/issue-7725-server-fn-factory.ts, e2e/react-start/import-protection/vite.config.ts, .changeset/tidy-pandas-load.md
Adds the issue reproduction route, server-function factory, build-only import-protection configuration, and patch changeset.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: sheraff

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change to preserve resolved virtual module IDs.
Linked Issues check ✅ Passed The changes preserve virtual-module IDs through resolution and loading, matching the mock-edge build-crash fix in #7725.
Out of Scope Changes check ✅ Passed The diff stays focused on preserving virtual IDs and reproducing the build issue; no unrelated feature work stands out.
✨ 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-7725

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

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

🟩 Patch bumps

Package Version Reason
@tanstack/start-plugin-core 1.171.22 → 1.171.23 Changeset
@tanstack/react-start 1.168.30 → 1.168.31 Dependent
@tanstack/react-start-rsc 0.1.29 → 0.1.30 Dependent
@tanstack/solid-start 1.168.30 → 1.168.31 Dependent
@tanstack/vue-start 1.168.29 → 1.168.30 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7844

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 1b8c994

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/start-plugin-core/src/vite/module-id.ts`:
- Around line 17-18: Update the module-ID flag appending logic around the
separator calculation so an ID ending with an empty query delimiter (`?`)
retains that delimiter through add/remove round trips; only use no separator
when the ID already ends with `&`, otherwise append `&`. Add a
`module-id.test.ts` case covering an ID ending in `?` and verifying the original
ID is restored after flag removal.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4cd54fab-b92b-4312-9455-0425cb753c6d

📥 Commits

Reviewing files that changed from the base of the PR and between e56a677 and 7bc436c.

📒 Files selected for processing (12)
  • .changeset/tidy-pandas-load.md
  • e2e/react-start/import-protection/src/routes/issue-7725.tsx
  • e2e/react-start/import-protection/src/violations/issue-7725-server-fn-factory.ts
  • e2e/react-start/import-protection/vite.config.ts
  • packages/start-plugin-core/src/import-protection/constants.ts
  • packages/start-plugin-core/src/start-compiler/compiler.ts
  • packages/start-plugin-core/src/start-compiler/utils.ts
  • packages/start-plugin-core/src/vite/import-protection-plugin/plugin.ts
  • packages/start-plugin-core/src/vite/module-id.ts
  • packages/start-plugin-core/src/vite/start-compiler-plugin/plugin.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/vite/module-id.test.ts
💤 Files with no reviewable changes (1)
  • packages/start-plugin-core/src/import-protection/constants.ts

Comment thread packages/start-plugin-core/src/vite/module-id.ts Outdated
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 770ba126cdd3
  • Measured at: 2026-07-18T17:21:54.292Z
  • Baseline source: history:62a191baa068
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.35 KiB 0 B (0.00%) 87.21 KiB 273.70 KiB 76.01 KiB ███▁▁▁▁▁▁▁▁
react-router.full 91.06 KiB 0 B (0.00%) 90.92 KiB 285.59 KiB 79.19 KiB ███▁▁▁▁▁▁▁▁
solid-router.minimal 35.53 KiB 0 B (0.00%) 35.40 KiB 105.90 KiB 31.94 KiB ███▁▁▁▁▁▁▁▁
solid-router.full 40.58 KiB 0 B (0.00%) 40.46 KiB 121.11 KiB 36.51 KiB ███▁▁▁▁▁▁▁▁
vue-router.minimal 53.00 KiB 0 B (0.00%) 52.87 KiB 149.94 KiB 47.63 KiB ███▁▁▁▁▁▁▁▁
vue-router.full 58.94 KiB 0 B (0.00%) 58.81 KiB 168.70 KiB 52.76 KiB ███▁▁▁▁▁▁▁▁
react-start.minimal 101.99 KiB 0 B (0.00%) 101.85 KiB 322.13 KiB 88.23 KiB ███▁▁▁▁▁▁▁▁
react-start.deferred-hydration 102.72 KiB 0 B (0.00%) 101.87 KiB 323.50 KiB 88.88 KiB ███▁▁▁▁▁▁▁▁
react-start.full 105.36 KiB 0 B (0.00%) 105.23 KiB 332.06 KiB 91.12 KiB ███▁▁▁▁▁▁▁▁
react-start.rsbuild.minimal 99.68 KiB 0 B (0.00%) 99.51 KiB 316.57 KiB 85.74 KiB ███▁▁▁▁▁▁▁▁
react-start.rsbuild.minimal-iife 100.08 KiB 0 B (0.00%) 99.91 KiB 317.51 KiB 86.11 KiB ███▁▁▁▁▁▁▁▁
react-start.rsbuild.full 102.89 KiB 0 B (0.00%) 102.72 KiB 326.63 KiB 88.52 KiB ███▁▁▁▁▁▁▁▁
solid-start.minimal 49.61 KiB 0 B (0.00%) 49.48 KiB 152.07 KiB 43.83 KiB ███▁▁▁▁▁▁▁▁
solid-start.deferred-hydration 52.87 KiB 0 B (0.00%) 49.53 KiB 160.11 KiB 46.89 KiB ███▁▁▁▁▁▁▁▁
solid-start.full 55.42 KiB 0 B (0.00%) 55.29 KiB 169.12 KiB 48.90 KiB ███▁▁▁▁▁▁▁▁
vue-start.minimal 71.03 KiB 0 B (0.00%) 70.90 KiB 207.19 KiB 62.89 KiB ███▁▁▁▁▁▁▁▁
vue-start.full 75.03 KiB 0 B (0.00%) 74.90 KiB 219.83 KiB 66.37 KiB ███▁▁▁▁▁▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 13.2%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
❌ 1 regressed benchmark
✅ 170 untouched benchmarks
⏩ 6 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server error-paths unmatched (react) 263.8 KB 844.6 KB -68.77%
Memory mem server error-paths redirect (vue) 732.1 KB 431.4 KB +69.71%
Memory mem server error-paths not-found (react) 276.7 KB 266.3 KB +3.93%
Simulation ssr streaming deferred (react) 73 ms 70.9 ms +3.03%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix-7725 (1b8c994) with main (62a191b)2

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (31a634d) during the generation of this report, so 62a191b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@schiller-manuel
schiller-manuel merged commit ffdd64e into main Jul 18, 2026
24 of 26 checks passed
@schiller-manuel
schiller-manuel deleted the fix-7725 branch July 18, 2026 18:08
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.

Start: mock-edge virtual module ENOENT crash in build mode (cleanId strips \0 before this.load())

1 participant