Skip to content

autoCodeSplitting encodes special characters #2361

Closed

Description

@oMatheuss

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

Activity

  1. added a commit that references this issue on Sep 18, 2024
  2. schiller-manuel commented on Sep 18, 2024

    @schiller-manuel
    Collaborator

    I cannot reproduce this 20b99b1#diff-8e4b3d34124256cda1eb526184dae1d90e35d9bc7fc9355bab24aeda71fdac18

    can you please share the full file that caused this issue?

  3. added
    information needed
    on Sep 18, 2024
  4. oMatheuss commented on Sep 18, 2024

    @oMatheuss
    Author

    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.

  5. removed
    information needed
    on Sep 18, 2024
  6. added a commit that references this issue on Sep 18, 2024
    3477140
  7. added a commit that references this issue on Sep 19, 2024
    d0a5638
  8. coldsmirk commented on Jan 16, 2025

    @coldsmirk

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions