Repository: TanStack/router (2025-08-11T07:34:36Z)

Issue:
Unexpected splitNode type ☝️: BooleanLiteral
### 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

<img width="3440" height="1440" alt="Image" src="https://github.com/user-attachments/assets/9e4032dd-f0cc-4c37-87ca-2c5477489b4e" />

### 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.


Discussion:
@Pavel-Liteiniy  I did a quick test and made some improvements. If you're not working on it, would it be okay to submit a PR?
Thanks @jiji-hoon96! I’m not working on a fix — please go ahead and open a PR. I can help test it on my repro and real app. 🙌
Thanks for giving me the chance to work on this
@Pavel-Liteiniy I’ve submitted a PR. Please test it and share your feedback.
@jiji-hoon96  thanks for the quick PR — I tested it and the build crash is gone ✅.
However, I’m still seeing a behavior discrepancy with `errorComponent: false`.

**Expected**

When a child route sets errorComponent: false, it should fall back to the nearest ancestor’s errorComponent (or defaultErrorComponent if none is found).

**Actual (with autoCodeSplitting: true)**

With the plugin configured as:

```
// vite.config.ts (similar with webpack)
tanstackRouter({ target: 'react', autoCodeSplitting: true })
```

navigating to a route that has `errorComponent: false` results in no error UI rendered at all (fallback does not apply).
If I switch to `autoCodeSplitting: false`, the fallback works as expected.

**Repro**
	•	Open the StackBlitz repro: https://stackblitz.com/edit/github-fb1d3cyr-ooygwpju
	•	Navigate to `/about`.
	•	Toggle autoCodeSplitting between true and false in vite.config.ts.
	•	true → no error UI (no fallback)
	•	false → fallback to parent/default error component works

**Environment**
	•	Plugin: @tanstack/router-plugin (testing the PR build from #4915)
	•	Bundlers: repro shows it with Vite; my real app uses the webpack plugin, and I see the same difference there.
	•	Router: @tanstack/react-router

Happy to test another patch :) If this is a separate concern from the crash fix, please let me know and I’ll open a new issue
Thank you! 

Thanks for testing and the detailed feedback! 🙏

You're absolutely right - I fixed the crash but missed the fallback behavior. I've now updated the PR to handle this correctly:

## ✅ **Fixed Issues**
1. **Build crash resolved** - No more `"Unexpected splitNode type ☝️: BooleanLiteral"`
2. **Fallback behavior restored** - `errorComponent: false` now properly falls back to parent

## 🔧 **Root Cause & Solution**
The issue was that I only handled the Virtual Route stage but missed the Reference Route stage. Now both stages properly skip code splitting for `false`/`null` values:

- `errorComponent: false` → stays in original route, enables fallback
- `pendingComponent: null` → stays in original route, enables fallback

## 🧪 **Test Results**
- ✅ All 226 tests pass
- ✅ `autoCodeSplitting: true` now works correctly with fallback
- ✅ Backward compatibility maintained

The fix is ready for another test! 🚀
@jiji-hoon96,  I've just re-tested with the updated PR — looks great! Thanks a ton for the quick turnaround and clear explanation! 🙌



Patch:
diff --git a/packages/react-router/src/route.tsx b/packages/react-router/src/route.tsx
index f1a3553131e..42fb9c388cd 100644
--- a/packages/react-router/src/route.tsx
+++ b/packages/react-router/src/route.tsx
@@ -49,7 +49,7 @@ import type { LinkComponentRoute } from './link'
 declare module '@tanstack/router-core' {
   export interface UpdatableRouteOptionsExtensions {
     component?: RouteComponent
-    errorComponent?: false | null | ErrorRouteComponent
+    errorComponent?: false | null | undefined | ErrorRouteComponent
     notFoundComponent?: NotFoundRouteComponent
     pendingComponent?: RouteComponent
   }
diff --git a/packages/router-plugin/src/core/code-splitter/compilers.ts b/packages/router-plugin/src/core/code-splitter/compilers.ts
index 650c8d3a1a2..fbf5a096a01 100644
--- a/packages/router-plugin/src/core/code-splitter/compilers.ts
+++ b/packages/router-plugin/src/core/code-splitter/compilers.ts
@@ -209,12 +209,14 @@ export function compileCodeSplitReferenceRoute(
                         return
                       }
 
-                      // Exit early if the value is undefined
-                      // Since we don't need to run an import just to get the value of `undefined`
-                      // This is useful for cases like: `createFileRoute('/')({ component: undefined })`
+                      // Exit early if the value is a boolean, null, or undefined.
+                      // These values mean "don't use this component, fallback to parent"
+                      // No code splitting needed to preserve fallback behavior
                       if (
-                        t.isIdentifier(prop.value) &&
-                        prop.value.name === 'undefined'
+                        t.isBooleanLiteral(prop.value) ||
+                        t.isNullLiteral(prop.value) ||
+                        (t.isIdentifier(prop.value) &&
+                          prop.value.name === 'undefined')
                       ) {
                         return
                       }
@@ -652,6 +654,14 @@ export function compileCodeSplitVirtualRoute(
                   ),
                 ]),
               )
+            } else if (t.isBooleanLiteral(splitNode)) {
+              // Handle boolean literals
+              // This exits early here, since this value will be kept in the reference file
+              return
+            } else if (t.isNullLiteral(splitNode)) {
+              // Handle null literals
+              // This exits early here, since this value will be kept in the reference file
+              return
             } else {
               console.info('Unexpected splitNode type:', splitNode)
               throw new Error(`Unexpected splitNode type ☝️: ${splitNode.type}`)
diff --git a/packages/solid-router/src/route.tsx b/packages/solid-router/src/route.tsx
index ed8411a4bca..bab412bea6b 100644
--- a/packages/solid-router/src/route.tsx
+++ b/packages/solid-router/src/route.tsx
@@ -49,7 +49,7 @@ import type { LinkComponentRoute } from './link'
 declare module '@tanstack/router-core' {
   export interface UpdatableRouteOptionsExtensions {
     component?: RouteComponent
-    errorComponent?: false | null | ErrorRouteComponent
+    errorComponent?: false | null | undefined | ErrorRouteComponent
     notFoundComponent?: NotFoundRouteComponent
     pendingComponent?: RouteComponent
   }


Test patch:
diff --git a/e2e/react-router/basic-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-file-based/src/routeTree.gen.ts
index 8150c3354d4..e5219215484 100644
--- a/e2e/react-router/basic-file-based/src/routeTree.gen.ts
+++ b/e2e/react-router/basic-file-based/src/routeTree.gen.ts
@@ -15,6 +15,7 @@ import { Route as Char45824Char54620Char48124Char44397RouteImport } from './rout
 import { Route as PostsRouteImport } from './routes/posts'
 import { Route as EditingBRouteImport } from './routes/editing-b'
 import { Route as EditingARouteImport } from './routes/editing-a'
+import { Route as ComponentTypesTestRouteImport } from './routes/component-types-test'
 import { Route as AnchorRouteImport } from './routes/anchor'
 import { Route as LayoutRouteImport } from './routes/_layout'
 import { Route as SearchParamsRouteRouteImport } from './routes/search-params/route'
@@ -80,6 +81,11 @@ const EditingARoute = EditingARouteImport.update({
   path: '/editing-a',
   getParentRoute: () => rootRouteImport,
 } as any)
+const ComponentTypesTestRoute = ComponentTypesTestRouteImport.update({
+  id: '/component-types-test',
+  path: '/component-types-test',
+  getParentRoute: () => rootRouteImport,
+} as any)
 const AnchorRoute = AnchorRouteImport.update({
   id: '/anchor',
   path: '/anchor',
@@ -276,6 +282,7 @@ export interface FileRoutesByFullPath {
   '/': typeof groupLayoutRouteWithChildren
   '/search-params': typeof SearchParamsRouteRouteWithChildren
   '/anchor': typeof AnchorRoute
+  '/component-types-test': typeof ComponentTypesTestRoute
   '/editing-a': typeof EditingARoute
   '/editing-b': typeof EditingBRoute
   '/posts': typeof PostsRouteWithChildren
@@ -315,6 +322,7 @@ export interface FileRoutesByFullPath {
 export interface FileRoutesByTo {
   '/': typeof groupLayoutRouteWithChildren
   '/anchor': typeof AnchorRoute
+  '/component-types-test': typeof ComponentTypesTestRoute
   '/editing-a': typeof EditingARoute
   '/editing-b': typeof EditingBRoute
   '/대한민국': typeof Char45824Char54620Char48124Char44397Route
@@ -355,6 +363,7 @@ export interface FileRoutesById {
   '/search-params': typeof SearchParamsRouteRouteWithChildren
   '/_layout': typeof LayoutRouteWithChildren
   '/anchor': typeof AnchorRoute
+  '/component-types-test': typeof ComponentTypesTestRoute
   '/editing-a': typeof EditingARoute
   '/editing-b': typeof EditingBRoute
   '/posts': typeof PostsRouteWithChildren
@@ -400,6 +409,7 @@ export interface FileRouteTypes {
     | '/'
     | '/search-params'
     | '/anchor'
+    | '/component-types-test'
     | '/editing-a'
     | '/editing-b'
     | '/posts'
@@ -439,6 +449,7 @@ export interface FileRouteTypes {
   to:
     | '/'
     | '/anchor'
+    | '/component-types-test'
     | '/editing-a'
     | '/editing-b'
     | '/대한민국'
@@ -478,6 +489,7 @@ export interface FileRouteTypes {
     | '/search-params'
     | '/_layout'
     | '/anchor'
+    | '/component-types-test'
     | '/editing-a'
     | '/editing-b'
     | '/posts'
@@ -523,6 +535,7 @@ export interface RootRouteChildren {
   SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren
   LayoutRoute: typeof LayoutRouteWithChildren
   AnchorRoute: typeof AnchorRoute
+  ComponentTypesTestRoute: typeof ComponentTypesTestRoute
   EditingARoute: typeof EditingARoute
   EditingBRoute: typeof EditingBRoute
   PostsRoute: typeof PostsRouteWithChildren
@@ -585,6 +598,13 @@ declare module '@tanstack/react-router' {
       preLoaderRoute: typeof EditingARouteImport
       parentRoute: typeof rootRouteImport
     }
+    '/component-types-test': {
+      id: '/component-types-test'
+      path: '/component-types-test'
+      fullPath: '/component-types-test'
+      preLoaderRoute: typeof ComponentTypesTestRouteImport
+      parentRoute: typeof rootRouteImport
+    }
     '/anchor': {
       id: '/anchor'
       path: '/anchor'
@@ -946,6 +966,7 @@ const rootRouteChildren: RootRouteChildren = {
   SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,
   LayoutRoute: LayoutRouteWithChildren,
   AnchorRoute: AnchorRoute,
+  ComponentTypesTestRoute: ComponentTypesTestRoute,
   EditingARoute: EditingARoute,
   EditingBRoute: EditingBRoute,
   PostsRoute: PostsRouteWithChildren,
diff --git a/e2e/react-router/basic-file-based/src/routes/component-types-test.tsx b/e2e/react-router/basic-file-based/src/routes/component-types-test.tsx
new file mode 100644
index 00000000000..5f675393d42
--- /dev/null
+++ b/e2e/react-router/basic-file-based/src/routes/component-types-test.tsx
@@ -0,0 +1,12 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+// Test route for type safety of different component types
+// This test should
+// - check that `false` can be set on the `errorComponent`
+// ...without causing build-time TypeScript errors
+export const Route = createFileRoute('/component-types-test')({
+  component: () => <div>Testing test types</div>,
+  errorComponent: false, // Should not cause TypeScript error
+  pendingComponent: undefined, // Should not cause TypeScript error
+  notFoundComponent: undefined, // Should not cause TypeScript error
+})
diff --git a/e2e/solid-router/basic-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-file-based/src/routeTree.gen.ts
index 2c9b87f4ef9..a77760bead6 100644
--- a/e2e/solid-router/basic-file-based/src/routeTree.gen.ts
+++ b/e2e/solid-router/basic-file-based/src/routeTree.gen.ts
@@ -14,6 +14,7 @@ import { Route as rootRouteImport } from './routes/__root'
 import { Route as PostsRouteImport } from './routes/posts'
 import { Route as EditingBRouteImport } from './routes/editing-b'
 import { Route as EditingARouteImport } from './routes/editing-a'
+import { Route as ComponentTypesTestRouteImport } from './routes/component-types-test'
 import { Route as AnchorRouteImport } from './routes/anchor'
 import { Route as LayoutRouteImport } from './routes/_layout'
 import { Route as SearchParamsRouteRouteImport } from './routes/search-params/route'
@@ -63,6 +64,11 @@ const EditingARoute = EditingARouteImport.update({
   path: '/editing-a',
   getParentRoute: () => rootRouteImport,
 } as any)
+const ComponentTypesTestRoute = ComponentTypesTestRouteImport.update({
+  id: '/component-types-test',
+  path: '/component-types-test',
+  getParentRoute: () => rootRouteImport,
+} as any)
 const AnchorRoute = AnchorRouteImport.update({
   id: '/anchor',
   path: '/anchor',
@@ -204,6 +210,7 @@ export interface FileRoutesByFullPath {
   '/': typeof groupLayoutRouteWithChildren
   '/search-params': typeof SearchParamsRouteRouteWithChildren
   '/anchor': typeof AnchorRoute
+  '/component-types-test': typeof ComponentTypesTestRoute
   '/editing-a': typeof EditingARoute
   '/editing-b': typeof EditingBRoute
   '/posts': typeof PostsRouteWithChildren
@@ -232,6 +239,7 @@ export interface FileRoutesByFullPath {
 export interface FileRoutesByTo {
   '/': typeof groupLayoutRouteWithChildren
   '/anchor': typeof AnchorRoute
+  '/component-types-test': typeof ComponentTypesTestRoute
   '/editing-a': typeof EditingARoute
   '/editing-b': typeof EditingBRoute
   '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute
@@ -261,6 +269,7 @@ export interface FileRoutesById {
   '/search-params': typeof SearchParamsRouteRouteWithChildren
   '/_layout': typeof LayoutRouteWithChildren
   '/anchor': typeof AnchorRoute
+  '/component-types-test': typeof ComponentTypesTestRoute
   '/editing-a': typeof EditingARoute
   '/editing-b': typeof EditingBRoute
   '/posts': typeof PostsRouteWithChildren
@@ -295,6 +304,7 @@ export interface FileRouteTypes {
     | '/'
     | '/search-params'
     | '/anchor'
+    | '/component-types-test'
     | '/editing-a'
     | '/editing-b'
     | '/posts'
@@ -323,6 +333,7 @@ export interface FileRouteTypes {
   to:
     | '/'
     | '/anchor'
+    | '/component-types-test'
     | '/editing-a'
     | '/editing-b'
     | '/onlyrouteinside'
@@ -351,6 +362,7 @@ export interface FileRouteTypes {
     | '/search-params'
     | '/_layout'
     | '/anchor'
+    | '/component-types-test'
     | '/editing-a'
     | '/editing-b'
     | '/posts'
@@ -385,6 +397,7 @@ export interface RootRouteChildren {
   SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren
   LayoutRoute: typeof LayoutRouteWithChildren
   AnchorRoute: typeof AnchorRoute
+  ComponentTypesTestRoute: typeof ComponentTypesTestRoute
   EditingARoute: typeof EditingARoute
   EditingBRoute: typeof EditingBRoute
   PostsRoute: typeof PostsRouteWithChildren
@@ -429,6 +442,13 @@ declare module '@tanstack/solid-router' {
       preLoaderRoute: typeof EditingARouteImport
       parentRoute: typeof rootRouteImport
     }
+    '/component-types-test': {
+      id: '/component-types-test'
+      path: '/component-types-test'
+      fullPath: '/component-types-test'
+      preLoaderRoute: typeof ComponentTypesTestRouteImport
+      parentRoute: typeof rootRouteImport
+    }
     '/anchor': {
       id: '/anchor'
       path: '/anchor'
@@ -720,6 +740,7 @@ const rootRouteChildren: RootRouteChildren = {
   SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,
   LayoutRoute: LayoutRouteWithChildren,
   AnchorRoute: AnchorRoute,
+  ComponentTypesTestRoute: ComponentTypesTestRoute,
   EditingARoute: EditingARoute,
   EditingBRoute: EditingBRoute,
   PostsRoute: PostsRouteWithChildren,
diff --git a/e2e/solid-router/basic-file-based/src/routes/component-types-test.tsx b/e2e/solid-router/basic-file-based/src/routes/component-types-test.tsx
new file mode 100644
index 00000000000..aa8cecd80e8
--- /dev/null
+++ b/e2e/solid-router/basic-file-based/src/routes/component-types-test.tsx
@@ -0,0 +1,12 @@
+import { createFileRoute } from '@tanstack/solid-router'
+
+// Test route for type safety of different component types
+// This test should
+// - check that `false` can be set on the `errorComponent`
+// ...without causing build-time TypeScript errors
+export const Route = createFileRoute('/component-types-test')({
+  component: () => <div>Testing test types</div>,
+  errorComponent: false, // Should not cause TypeScript error
+  pendingComponent: undefined, // Should not cause TypeScript error
+  notFoundComponent: undefined, // Should not cause TypeScript error
+})
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals.tsx
new file mode 100644
index 00000000000..771fd14f8b8
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals.tsx
@@ -0,0 +1,13 @@
+const $$splitComponentImporter = () => import('boolean-null-literals.tsx?tsr-split=component');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/router';
+
+// Test errorComponent with false literal
+export const Route = createFileRoute('/test')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  errorComponent: false,
+  pendingComponent: null,
+  loader: async () => ({
+    data: 'test'
+  })
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@component.tsx
new file mode 100644
index 00000000000..8ff04083aa2
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@component.tsx
@@ -0,0 +1,4 @@
+// Test errorComponent with false literal
+import { Route } from "boolean-null-literals.tsx";
+const SplitComponent = () => <div>Test Component</div>;
+export { SplitComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@errorComponent.tsx
new file mode 100644
index 00000000000..866123caaef
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@errorComponent.tsx
@@ -0,0 +1,2 @@
+// Test errorComponent with false literal
+import { Route } from "boolean-null-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@notFoundComponent.tsx
new file mode 100644
index 00000000000..866123caaef
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@notFoundComponent.tsx
@@ -0,0 +1,2 @@
+// Test errorComponent with false literal
+import { Route } from "boolean-null-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals.tsx
new file mode 100644
index 00000000000..1491ba7c3a7
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals.tsx
@@ -0,0 +1,7 @@
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/undefined-test')({
+  component: undefined,
+  errorComponent: undefined,
+  pendingComponent: undefined,
+  notFoundComponent: undefined
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@component.tsx
new file mode 100644
index 00000000000..81364cb80cc
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@component.tsx
@@ -0,0 +1,1 @@
+import { Route } from "undefined-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@errorComponent.tsx
new file mode 100644
index 00000000000..81364cb80cc
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@errorComponent.tsx
@@ -0,0 +1,1 @@
+import { Route } from "undefined-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@notFoundComponent.tsx
new file mode 100644
index 00000000000..81364cb80cc
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@notFoundComponent.tsx
@@ -0,0 +1,1 @@
+import { Route } from "undefined-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals.tsx
new file mode 100644
index 00000000000..c31ee0e0952
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals.tsx
@@ -0,0 +1,13 @@
+const $$splitLoaderImporter = () => import('boolean-null-literals.tsx?tsr-split=loader');
+import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () => import('boolean-null-literals.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/router';
+
+// Test errorComponent with false literal
+export const Route = createFileRoute('/test')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  errorComponent: false,
+  pendingComponent: null,
+  loader: lazyFn($$splitLoaderImporter, 'loader')
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 00000000000..8ff04083aa2
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,4 @@
+// Test errorComponent with false literal
+import { Route } from "boolean-null-literals.tsx";
+const SplitComponent = () => <div>Test Component</div>;
+export { SplitComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@loader.tsx
new file mode 100644
index 00000000000..56241c37b36
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@loader.tsx
@@ -0,0 +1,6 @@
+// Test errorComponent with false literal
+import { Route } from "boolean-null-literals.tsx";
+const SplitLoader = async () => ({
+  data: 'test'
+});
+export { SplitLoader as loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx
new file mode 100644
index 00000000000..1491ba7c3a7
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx
@@ -0,0 +1,7 @@
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/undefined-test')({
+  component: undefined,
+  errorComponent: undefined,
+  pendingComponent: undefined,
+  notFoundComponent: undefined
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 00000000000..81364cb80cc
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,1 @@
+import { Route } from "undefined-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@loader.tsx
new file mode 100644
index 00000000000..81364cb80cc
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@loader.tsx
@@ -0,0 +1,1 @@
+import { Route } from "undefined-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals.tsx
new file mode 100644
index 00000000000..d3f54dd789e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals.tsx
@@ -0,0 +1,13 @@
+const $$splitLoaderImporter = () => import('boolean-null-literals.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () => import('boolean-null-literals.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/router';
+
+// Test errorComponent with false literal
+export const Route = createFileRoute('/test')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  errorComponent: false,
+  pendingComponent: null,
+  loader: lazyFn($$splitLoaderImporter, 'loader')
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@component---loader---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 00000000000..0462827cc9c
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@component---loader---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,8 @@
+// Test errorComponent with false literal
+import { Route } from "boolean-null-literals.tsx";
+const SplitLoader = async () => ({
+  data: 'test'
+});
+export { SplitLoader as loader };
+const SplitComponent = () => <div>Test Component</div>;
+export { SplitComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@errorComponent.tsx
new file mode 100644
index 00000000000..866123caaef
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@errorComponent.tsx
@@ -0,0 +1,2 @@
+// Test errorComponent with false literal
+import { Route } from "boolean-null-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals.tsx
new file mode 100644
index 00000000000..1491ba7c3a7
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals.tsx
@@ -0,0 +1,7 @@
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/undefined-test')({
+  component: undefined,
+  errorComponent: undefined,
+  pendingComponent: undefined,
+  notFoundComponent: undefined
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@component---loader---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 00000000000..81364cb80cc
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@component---loader---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,1 @@
+import { Route } from "undefined-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@errorComponent.tsx
new file mode 100644
index 00000000000..81364cb80cc
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@errorComponent.tsx
@@ -0,0 +1,1 @@
+import { Route } from "undefined-literals.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/test-files/react/boolean-null-literals.tsx b/packages/router-plugin/tests/code-splitter/test-files/react/boolean-null-literals.tsx
new file mode 100644
index 00000000000..35f0d0eeeb1
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/test-files/react/boolean-null-literals.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/router'
+
+// Test errorComponent with false literal
+export const Route = createFileRoute('/test')({
+  component: () => <div>Test Component</div>,
+  errorComponent: false,
+  pendingComponent: null,
+  loader: async () => ({ data: 'test' }),
+})
diff --git a/packages/router-plugin/tests/code-splitter/test-files/react/undefined-literals.tsx b/packages/router-plugin/tests/code-splitter/test-files/react/undefined-literals.tsx
new file mode 100644
index 00000000000..0c6e4f01aa9
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/test-files/react/undefined-literals.tsx
@@ -0,0 +1,8 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/undefined-test')({
+  component: undefined,
+  errorComponent: undefined,
+  pendingComponent: undefined,
+  notFoundComponent: undefined,
+})