Skip to content

fix(router-plugin): escape single quotes in split route file paths#7892

Draft
okxint wants to merge 1 commit into
TanStack:mainfrom
okxint:fix/code-splitter-path-apostrophe
Draft

fix(router-plugin): escape single quotes in split route file paths#7892
okxint wants to merge 1 commit into
TanStack:mainfrom
okxint:fix/code-splitter-path-apostrophe

Conversation

@okxint

@okxint okxint commented Jul 24, 2026

Copy link
Copy Markdown

When a project directory contains a single quote (e.g. /Users/dev/it's here/app), the code-splitter generates syntactically invalid JavaScript:

// Generated — broken
const $$splitComponentImporter = () => import('/Users/dev/it's here/app/routes/index.tsx')
//                                                              ^ unmatched quote

Babel then throws on every route, surfacing as a 500 on the entire app. Setting autoCodeSplitting: false doesn't help because the plugin registers unconditionally.

Fix: escape single quotes in splitUrl before interpolation at both sites in compilers.ts (lines 626 and 722):

splitUrl.replace(/'/g, "\\'")

This is the minimal change to make path-with-apostrophe projects work without touching the broader autoCodeSplitting config gate.

Fixes #7754

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a0a5d393-054f-46fa-8bf6-2cdf2c9ca6c1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code-splitter breaks every route when the project path contains a single quote/apostrophe (autoCodeSplitting: false does not avoid it)

1 participant