Skip to content
Source
Sign inSign up
TanStack/router

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

Openokxint(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7892/headopened

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

    1. 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 in to join this conversation.