Skip to content
Source
Sign inSign up
TanStack/router

autoCodeSplitting encodes special characters #2361

Send to my agent
ClosedoMatheuss(GitHub profile, opens in a new tab) opened this issue 3 comments

Which project does this relate to?

Router

Describe the bug

I'm using @tanstack/react-router@^1.57.10 with vite@^5.4.4, @vitejs/plugin-react-swc@^3.7.0 and @tanstack/router-plugin@^1.57.11. When I build my application with the flag autoCodeSplitting set to true, it does work but it also double encodes all route files.

This means that words like Usuário becames Usu\\xE1rio. Notice the double backslash, which was probably added by the router-code-splitter-plugin. I enabled the TSR_VITE_DEBUG=true when building and noticed that it already encodes the output (Usuário -> Usu\xE1rio). What probably happens is that it probably reencodes down the plugin pipeline. And if I disable code splitting it doesn't even encodes the files.

Another bug less annoying I noticed is that I couldn't export from route files. This gave me an error when building, but I solved moving the function I needed to another regular file.

Also tested with @vitejs/plugin-react, same problem.

Your Example Website or App

I couldn't reproduce in stackblitz, sorry.

Steps to Reproduce the Bug or Issue

  1. Have a project with vite and tanstack router.
  2. Enable autoCodeSplitting.
  3. Route files will be double encoded.

Expected behavior

Auto code sppliting should not encode words: Usuário -> Usu\\xE1rio

Screenshots or Videos

No response

Platform

  • OS: Ubuntu 24.04 (tested on two different machines)
  • Browser: Any
  • Version: Any

Additional context

No response

  1. schiller-manuel(GitHub profile, opens in a new tab) added labelsinformation needed

  2. Ok, I could finally reproduce this error with minimal configuration on stackbluitz here.

    In dev mode, everything is fine. You need to tun npm run build and npm run preview.

    @schiller-manuel thanks for looking into it.

  3. schiller-manuel(GitHub profile, opens in a new tab) removed labelsinformation needed

  4. The issue hasn't been fully resolved, and I've encountered the same problem. Up to now, Chinese characters are still being escaped into Unicode encoding. This issue only occurs when autoCodeSplitting is enabled.

    Image Image

Sign in to join this conversation.