Skip to content

Conversation

@SeanCassiere
Copy link
Member

@SeanCassiere SeanCassiere commented Jan 8, 2026

The route generator stores file paths with forward slashes but rspack and webpack on Windows pass native paths with backslashes to transform handlers.
This caused TSR_ROUTES_BY_ID_MAP lookups to fail, preventing autoCodeSplitting from working on Windows with rspack. The route generator stores file paths with forward slashes, but rspack and webpack on Windows pass native paths with backslashes to transform handlers.

This caused TSR_ROUTES_BY_ID_MAP lookups to fail, preventing autoCodeSplitting from working on Windows with rspack.

Closes #6253

Summary by CodeRabbit

  • Bug Fixes
    • Fixed path normalization for route handling across Windows and Unix-based systems to ensure consistent behavior regardless of operating system.

✏️ Tip: You can customize this high-level summary in your review settings.

…th rspack/webpack

The route generator stores file paths with forward slashes
but rspack and webpack on Windows pass native paths with
backslashes to transform handlers.
This caused TSR_ROUTES_BY_ID_MAP lookups to fail, preventing
autoCodeSplitting from working on Windows with rspack.The
route generator stores file paths with forward slashes, but
rspack and webpack on Windows pass native paths with backslashes to
transform handlers.

This caused TSR_ROUTES_BY_ID_MAP lookups to fail, preventing
autoCodeSplitting from working on Windows with rspack.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This change introduces path normalization across the router plugin to fix an autoCodeSplitting bug on Windows. A new normalizePath utility converts backslashes to forward slashes, ensuring consistent route ID handling across bundlers and operating systems.

Changes

Cohort / File(s) Summary
Path Normalization Utility
packages/router-plugin/src/core/utils.ts
Added normalizePath(path: string) function that converts Windows-style backslashes to forward slashes via regex replacement for cross-platform path consistency
Plugin Updates
packages/router-plugin/src/core/route-autoimport-plugin.ts, packages/router-plugin/src/core/router-code-splitter-plugin.ts, packages/router-plugin/src/core/router-hmr-plugin.ts
Imported normalizePath and applied it to route IDs before map lookups (TSR_ROUTES_BY_ID_MAP), logging statements, and AST/HMR metadata generation across all three plugins
Test Coverage
packages/router-plugin/tests/utils.test.ts
New test suite validating normalizePath with Windows backslashes, mixed slashes, forward slashes, relative paths, empty strings, and query string preservation

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • nlynzaad
  • schiller-manuel

Poem

🐰 A rabbit hops across the Windows lane,
With forward slashes clearing up the strain,
Backslashes tamed to path perfection,
Code splitting shines in every direction! 🚀

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0caca3f and 29e5080.

📒 Files selected for processing (5)
  • packages/router-plugin/src/core/route-autoimport-plugin.ts
  • packages/router-plugin/src/core/router-code-splitter-plugin.ts
  • packages/router-plugin/src/core/router-hmr-plugin.ts
  • packages/router-plugin/src/core/utils.ts
  • packages/router-plugin/tests/utils.test.ts

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 Jan 8, 2026

View your CI Pipeline Execution ↗ for commit 29e5080

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

☁️ Nx Cloud last updated this comment at 2026-01-08 12:28:46 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 8, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6333

@tanstack/eslint-plugin-router

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

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6333

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6333

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6333

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6333

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6333

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6333

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6333

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6333

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6333

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6333

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6333

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6333

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6333

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6333

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6333

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6333

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6333

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6333

commit: 29e5080

@SeanCassiere SeanCassiere marked this pull request as ready for review January 9, 2026 07:12
@SeanCassiere SeanCassiere merged commit 70248f2 into main Jan 9, 2026
5 of 6 checks passed
@SeanCassiere SeanCassiere deleted the windows-codesplitting branch January 9, 2026 07:13
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.

rsbuild autoCodeSplitting is not work in windows platform

2 participants