Skip to content

Unexpected splitNode type ☝️: BooleanLiteral #4891

@Pavel-Liteiniy

Description

@Pavel-Liteiniy

Which project does this relate to?

Router

Describe the bug

When @tanstack/router-plugin auto code splitting is enabled, the transform crashes if any route sets errorComponent to null or false.

Type definitions allow this (errorComponent?: false | null | ErrorRouteComponent), but the code-splitter fails with:

Error: Unexpected splitNode type ☝️: BooleanLiteral
    at .../@tanstack/router-plugin/src/core/code-splitter/compilers.ts:621:21
    at Set.forEach (<anonymous>)
    ...

Your Example Website or App

https://stackblitz.com/edit/github-fb1d3cyr

Steps to Reproduce the Bug or Issue

  1. Open terminal
  2. Run npm run build

Expected behavior

The plugin should gracefully handle booleans/nulls

Screenshots or Videos

Image

Platform

  • @tanstack/router-plugin: 1.130.16
  • @tanstack/react-router: 1.130.12
  • webpack: 5.91.0

Additional context

I'm setting errorComponent to null to handle all errors in my app using only defaultErrorComponent.

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