From 722c7ed52608b08746291eed8737d6f38d6cd478 Mon Sep 17 00:00:00 2001
From: Brooke Holmes <git@brooke.me>
Date: Wed, 29 Oct 2025 09:29:59 +0000
Subject: [PATCH 1/3] wip

# Conflicts:
#	packages/router-plugin/src/core/code-splitter/compilers.ts
---
 .../src/core/code-splitter/compilers.ts       | 123 +++++++++++++++++-
 1 file changed, 117 insertions(+), 6 deletions(-)

diff --git a/packages/router-plugin/src/core/code-splitter/compilers.ts b/packages/router-plugin/src/core/code-splitter/compilers.ts
index 43b8c8db4f..19f07615b9 100644
--- a/packages/router-plugin/src/core/code-splitter/compilers.ts
+++ b/packages/router-plugin/src/core/code-splitter/compilers.ts
@@ -628,6 +628,23 @@ export function compileCodeSplitVirtualRoute(
               if (t.isIdentifier(splitNode.id)) {
                 splitMeta.localExporterIdent = splitNode.id.name
                 splitMeta.shouldRemoveNode = false
+              } else if (t.isObjectPattern(splitNode.id) && t.isIdentifier(splitKey.node)) {
+                const matchingProperty = splitNode.id.properties.find((prop) => {
+                  return (
+                    t.isObjectProperty(prop) &&
+                    t.isIdentifier(prop.value) &&
+                    prop.value.name === splitKey.node.name
+                  )
+                })
+
+                if (!matchingProperty) {
+                  throw new Error(
+                    `Unable to locate the "${splitKey.node.name}" binding while splitting "${SPLIT_TYPE}".`,
+                  )
+                }
+
+                splitMeta.localExporterIdent = splitKey.node.name
+                splitMeta.shouldRemoveNode = false
               } else {
                 throw new Error(
                   `Unexpected splitNode type ☝️: ${splitNode.type}`,
@@ -731,13 +748,75 @@ export function compileCodeSplitVirtualRoute(
 
             if (path.node.declaration) {
               if (t.isVariableDeclaration(path.node.declaration)) {
+                const specifiers = path.node.declaration.declarations.flatMap(
+                  (decl) => {
+                    if (!t.isVariableDeclarator(decl)) {
+                      return []
+                    }
+
+                    const identifiers: Array<t.Identifier> = []
+
+                    const collectIdentifiers = (
+                      node: t.Node | null | undefined,
+                    ) => {
+                      if (!node) {
+                        return
+                      }
+
+                      if (t.isIdentifier(node)) {
+                        identifiers.push(node)
+                        return
+                      }
+
+                      if (t.isAssignmentPattern(node)) {
+                        collectIdentifiers(node.left)
+                        return
+                      }
+
+                      if (t.isRestElement(node)) {
+                        collectIdentifiers(node.argument)
+                        return
+                      }
+
+                      if (t.isObjectPattern(node)) {
+                        node.properties.forEach((prop) => {
+                          if (t.isObjectProperty(prop)) {
+                            collectIdentifiers(prop.value as t.Node)
+                          } else if (t.isRestElement(prop)) {
+                            collectIdentifiers(prop.argument)
+                          }
+                        })
+                        return
+                      }
+
+                      if (t.isArrayPattern(node)) {
+                        node.elements.forEach((element) => {
+                          if (!element) {
+                            return
+                          }
+                          collectIdentifiers(element as t.Node)
+                        })
+                      }
+                    }
+
+                    collectIdentifiers(decl.id)
+
+                    return identifiers.map((identifier) =>
+                      t.importSpecifier(
+                        t.identifier(identifier.name),
+                        t.identifier(identifier.name),
+                      ),
+                    )
+                  },
+                )
+
+                if (specifiers.length === 0) {
+                  path.remove()
+                  return
+                }
+
                 const importDecl = t.importDeclaration(
-                  path.node.declaration.declarations.map((decl) =>
-                    t.importSpecifier(
-                      t.identifier((decl.id as any).name),
-                      t.identifier((decl.id as any).name),
-                    ),
-                  ),
+                  specifiers,
                   t.stringLiteral(
                     removeSplitSearchParamFromFilename(opts.filename),
                   ),
@@ -943,6 +1022,38 @@ function resolveIdentifier(path: any, node: any): t.Node | undefined {
 function removeIdentifierLiteral(path: babel.NodePath, node: t.Identifier) {
   const binding = path.scope.getBinding(node.name)
   if (binding) {
+    if (
+      t.isVariableDeclarator(binding.path.node) &&
+      t.isObjectPattern(binding.path.node.id)
+    ) {
+      const objectPattern = binding.path.node.id
+      objectPattern.properties = objectPattern.properties.filter((prop) => {
+        if (!t.isObjectProperty(prop)) {
+          return true
+        }
+
+        if (t.isIdentifier(prop.value) && prop.value.name === node.name) {
+          return false
+        }
+
+        if (
+          t.isAssignmentPattern(prop.value) &&
+          t.isIdentifier(prop.value.left) &&
+          prop.value.left.name === node.name
+        ) {
+          return false
+        }
+
+        return true
+      })
+
+      if (objectPattern.properties.length === 0) {
+        binding.path.remove()
+      }
+
+      return
+    }
+
     binding.path.remove()
   }
 }

From aa2dd870122d39811c09b340bb7c712e3e677c99 Mon Sep 17 00:00:00 2001
From: Brooke Holmes <git@brooke.me>
Date: Wed, 29 Oct 2025 09:30:07 +0000
Subject: [PATCH 2/3] tests tests tests

---
 .../react/1-default/destructured-export.tsx   | 19 +++++++++++++++++++
 .../destructured-export@component.tsx         | 14 ++++++++++++++
 .../destructured-export@errorComponent.tsx    |  1 +
 .../destructured-export@notFoundComponent.tsx |  1 +
 .../1-default/retain-exports-destructured.tsx | 19 +++++++++++++++++++
 .../retain-exports-destructured@component.tsx |  3 +++
 ...in-exports-destructured@errorComponent.tsx |  2 ++
 ...exports-destructured@notFoundComponent.tsx |  2 ++
 .../destructured-export.tsx                   |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx | 14 ++++++++++++++
 .../destructured-export@loader.tsx            | 14 ++++++++++++++
 .../retain-exports-destructured.tsx           |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx |  3 +++
 .../retain-exports-destructured@loader.tsx    |  3 +++
 .../destructured-export.tsx                   |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx | 16 ++++++++++++++++
 .../destructured-export@errorComponent.tsx    |  1 +
 .../retain-exports-destructured.tsx           |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx |  4 ++++
 ...in-exports-destructured@errorComponent.tsx |  2 ++
 .../solid/1-default/destructured-export.tsx   | 19 +++++++++++++++++++
 .../destructured-export@component.tsx         | 14 ++++++++++++++
 .../destructured-export@errorComponent.tsx    |  1 +
 .../destructured-export@notFoundComponent.tsx |  1 +
 .../1-default/retain-exports-destructured.tsx | 19 +++++++++++++++++++
 .../retain-exports-destructured@component.tsx |  3 +++
 ...in-exports-destructured@errorComponent.tsx |  2 ++
 ...exports-destructured@notFoundComponent.tsx |  2 ++
 .../destructured-export.tsx                   |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx | 14 ++++++++++++++
 .../destructured-export@loader.tsx            | 14 ++++++++++++++
 .../retain-exports-destructured.tsx           |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx |  3 +++
 .../retain-exports-destructured@loader.tsx    |  3 +++
 .../destructured-export.tsx                   |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx | 16 ++++++++++++++++
 .../destructured-export@errorComponent.tsx    |  1 +
 .../retain-exports-destructured.tsx           |  9 +++++++++
 ...--notFoundComponent---pendingComponent.tsx |  4 ++++
 ...in-exports-destructured@errorComponent.tsx |  2 ++
 .../test-files/react/destructured-export.tsx  | 19 +++++++++++++++++++
 .../react/retain-exports-destructured.tsx     | 19 +++++++++++++++++++
 .../test-files/solid/destructured-export.tsx  | 19 +++++++++++++++++++
 .../solid/retain-exports-destructured.tsx     | 19 +++++++++++++++++++
 44 files changed, 384 insertions(+)
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-destructured.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx
 create mode 100644 packages/router-plugin/tests/code-splitter/test-files/solid/retain-exports-destructured.tsx

diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx
new file mode 100644
index 0000000000..45b35c5ca7
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx
@@ -0,0 +1,19 @@
+const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx
new file mode 100644
index 0000000000..f15a56deeb
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx
@@ -0,0 +1,14 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  component: AboutComponent
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx
new file mode 100644
index 0000000000..92a117a86e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx
@@ -0,0 +1 @@
+import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx
new file mode 100644
index 0000000000..92a117a86e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx
@@ -0,0 +1 @@
+import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..81284bb02d
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured.tsx
@@ -0,0 +1,19 @@
+const $$splitComponentImporter = () => import('retain-exports-destructured.tsx?tsr-split=component');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+export const {
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx
new file mode 100644
index 0000000000..14b6198d2b
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx
@@ -0,0 +1,3 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx
new file mode 100644
index 0000000000..96bcbe8e58
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx
@@ -0,0 +1,2 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx
new file mode 100644
index 0000000000..96bcbe8e58
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx
@@ -0,0 +1,2 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export.tsx
new file mode 100644
index 0000000000..abc5c82bc7
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('destructured-export.tsx?tsr-split=loader');
+import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  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/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..f15a56deeb
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,14 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  component: AboutComponent
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx
new file mode 100644
index 0000000000..ae0fa6e2c2
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx
@@ -0,0 +1,14 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..9632bc58fd
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('retain-exports-destructured.tsx?tsr-split=loader');
+import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () => import('retain-exports-destructured.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  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/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..14b6198d2b
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,3 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
new file mode 100644
index 0000000000..496411052d
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
@@ -0,0 +1,3 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export.tsx
new file mode 100644
index 0000000000..a0a394a009
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  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/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..033b36bcd6
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,16 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  component: AboutComponent,
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { loader };
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
new file mode 100644
index 0000000000..92a117a86e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
@@ -0,0 +1 @@
+import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..7a6a706608
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('retain-exports-destructured.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyFn } from '@tanstack/react-router';
+const $$splitComponentImporter = () => import('retain-exports-destructured.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  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/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..5ed998e5ed
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,4 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { loader };
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
new file mode 100644
index 0000000000..96bcbe8e58
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
@@ -0,0 +1,2 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx
new file mode 100644
index 0000000000..96043ea61f
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx
@@ -0,0 +1,19 @@
+const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component');
+import { lazyRouteComponent } from '@tanstack/solid-router';
+import { createFileRoute } from '@tanstack/solid-router';
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx
new file mode 100644
index 0000000000..f15a56deeb
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx
@@ -0,0 +1,14 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  component: AboutComponent
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx
new file mode 100644
index 0000000000..92a117a86e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx
@@ -0,0 +1 @@
+import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx
new file mode 100644
index 0000000000..92a117a86e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx
@@ -0,0 +1 @@
+import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..d362d6129c
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured.tsx
@@ -0,0 +1,19 @@
+const $$splitComponentImporter = () => import('retain-exports-destructured.tsx?tsr-split=component');
+import { lazyRouteComponent } from '@tanstack/solid-router';
+import { createFileRoute } from '@tanstack/solid-router';
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+export const {
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx
new file mode 100644
index 0000000000..14b6198d2b
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx
@@ -0,0 +1,3 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx
new file mode 100644
index 0000000000..96bcbe8e58
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx
@@ -0,0 +1,2 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx
new file mode 100644
index 0000000000..96bcbe8e58
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx
@@ -0,0 +1,2 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export.tsx
new file mode 100644
index 0000000000..ce56a67783
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('destructured-export.tsx?tsr-split=loader');
+import { lazyFn } from '@tanstack/solid-router';
+const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/solid-router';
+import { createFileRoute } from '@tanstack/solid-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader: lazyFn($$splitLoaderImporter, 'loader')
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..f15a56deeb
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,14 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  component: AboutComponent
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx
new file mode 100644
index 0000000000..ae0fa6e2c2
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx
@@ -0,0 +1,14 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..897a254f5e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('retain-exports-destructured.tsx?tsr-split=loader');
+import { lazyFn } from '@tanstack/solid-router';
+const $$splitComponentImporter = () => import('retain-exports-destructured.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/solid-router';
+import { createFileRoute } from '@tanstack/solid-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader: lazyFn($$splitLoaderImporter, 'loader')
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..14b6198d2b
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,3 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
new file mode 100644
index 0000000000..496411052d
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
@@ -0,0 +1,3 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export.tsx
new file mode 100644
index 0000000000..b80992ddd7
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyFn } from '@tanstack/solid-router';
+const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/solid-router';
+import { createFileRoute } from '@tanstack/solid-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader: lazyFn($$splitLoaderImporter, 'loader')
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..033b36bcd6
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,16 @@
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello'
+  })
+});
+const {
+  component: AboutComponent,
+  loader
+} = createBits();
+function AboutComponentImpl() {
+  return <div>About</div>;
+}
+import { Route } from "destructured-export.tsx";
+export { loader };
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
new file mode 100644
index 0000000000..92a117a86e
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
@@ -0,0 +1 @@
+import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..3338df3e5d
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx
@@ -0,0 +1,9 @@
+const $$splitLoaderImporter = () => import('retain-exports-destructured.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyFn } from '@tanstack/solid-router';
+const $$splitComponentImporter = () => import('retain-exports-destructured.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');
+import { lazyRouteComponent } from '@tanstack/solid-router';
+import { createFileRoute } from '@tanstack/solid-router';
+export const Route = createFileRoute('/about')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component'),
+  loader: lazyFn($$splitLoaderImporter, 'loader')
+});
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
new file mode 100644
index 0000000000..5ed998e5ed
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
@@ -0,0 +1,4 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
+export { loader };
+export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
new file mode 100644
index 0000000000..96bcbe8e58
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
@@ -0,0 +1,2 @@
+import { AboutComponent, loader } from "retain-exports-destructured.tsx";
+import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx
new file mode 100644
index 0000000000..5ee98ab482
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx
@@ -0,0 +1,19 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello',
+  }),
+})
+
+const { component: AboutComponent, loader } = createBits()
+
+function AboutComponentImpl() {
+  return <div>About</div>
+}
+
+export const Route = createFileRoute('/about')({
+  component: AboutComponent,
+  loader,
+})
diff --git a/packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..0e3175116f
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-destructured.tsx
@@ -0,0 +1,19 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello',
+  }),
+})
+
+export const { component: AboutComponent, loader } = createBits()
+
+function AboutComponentImpl() {
+  return <div>About</div>
+}
+
+export const Route = createFileRoute('/about')({
+  component: AboutComponent,
+  loader,
+})
diff --git a/packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx
new file mode 100644
index 0000000000..3f723123b0
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx
@@ -0,0 +1,19 @@
+import { createFileRoute } from '@tanstack/solid-router'
+
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello',
+  }),
+})
+
+const { component: AboutComponent, loader } = createBits()
+
+function AboutComponentImpl() {
+  return <div>About</div>
+}
+
+export const Route = createFileRoute('/about')({
+  component: AboutComponent,
+  loader,
+})
diff --git a/packages/router-plugin/tests/code-splitter/test-files/solid/retain-exports-destructured.tsx b/packages/router-plugin/tests/code-splitter/test-files/solid/retain-exports-destructured.tsx
new file mode 100644
index 0000000000..1f1a29fc55
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/test-files/solid/retain-exports-destructured.tsx
@@ -0,0 +1,19 @@
+import { createFileRoute } from '@tanstack/solid-router'
+
+const createBits = () => ({
+  component: AboutComponentImpl,
+  loader: () => ({
+    message: 'hello',
+  }),
+})
+
+export const { component: AboutComponent, loader } = createBits()
+
+function AboutComponentImpl() {
+  return <div>About</div>
+}
+
+export const Route = createFileRoute('/about')({
+  component: AboutComponent,
+  loader,
+})

From 79c3776239d6129c08947cd0dcd6dde792e5e28a Mon Sep 17 00:00:00 2001
From: Brooke Holmes <git@brooke.me>
Date: Sun, 2 Nov 2025 16:18:11 +0000
Subject: [PATCH 3/3] handle destructured bindings with defaults

---
 .../src/core/code-splitter/compilers.ts       | 21 ++++++++++++++-----
 .../react/1-default/destructured-export.tsx   |  5 ++++-
 .../destructured-export@component.tsx         |  6 ++++--
 .../destructured-export@errorComponent.tsx    |  1 -
 .../destructured-export@notFoundComponent.tsx |  1 -
 .../retain-exports-destructured@component.tsx |  3 +--
 ...in-exports-destructured@errorComponent.tsx |  2 --
 ...exports-destructured@notFoundComponent.tsx |  2 --
 ...--notFoundComponent---pendingComponent.tsx |  6 ++++--
 .../destructured-export@loader.tsx            |  6 ++++--
 ...--notFoundComponent---pendingComponent.tsx |  3 +--
 .../retain-exports-destructured@loader.tsx    |  3 +--
 ...--notFoundComponent---pendingComponent.tsx | 11 +++++++---
 .../destructured-export@errorComponent.tsx    |  1 -
 ...--notFoundComponent---pendingComponent.tsx |  1 -
 ...in-exports-destructured@errorComponent.tsx |  2 --
 .../solid/1-default/destructured-export.tsx   |  5 ++++-
 .../destructured-export@component.tsx         |  6 ++++--
 .../destructured-export@errorComponent.tsx    |  1 -
 .../destructured-export@notFoundComponent.tsx |  1 -
 .../retain-exports-destructured@component.tsx |  3 +--
 ...in-exports-destructured@errorComponent.tsx |  2 --
 ...exports-destructured@notFoundComponent.tsx |  2 --
 ...--notFoundComponent---pendingComponent.tsx |  6 ++++--
 .../destructured-export@loader.tsx            |  6 ++++--
 ...--notFoundComponent---pendingComponent.tsx |  3 +--
 .../retain-exports-destructured@loader.tsx    |  3 +--
 ...--notFoundComponent---pendingComponent.tsx | 11 +++++++---
 .../destructured-export@errorComponent.tsx    |  1 -
 ...--notFoundComponent---pendingComponent.tsx |  1 -
 ...in-exports-destructured@errorComponent.tsx |  2 --
 .../test-files/react/destructured-export.tsx  | 10 ++++++++-
 .../test-files/solid/destructured-export.tsx  | 10 ++++++++-
 33 files changed, 88 insertions(+), 59 deletions(-)

diff --git a/packages/router-plugin/src/core/code-splitter/compilers.ts b/packages/router-plugin/src/core/code-splitter/compilers.ts
index 19f07615b9..a010ff3637 100644
--- a/packages/router-plugin/src/core/code-splitter/compilers.ts
+++ b/packages/router-plugin/src/core/code-splitter/compilers.ts
@@ -630,11 +630,22 @@ export function compileCodeSplitVirtualRoute(
                 splitMeta.shouldRemoveNode = false
               } else if (t.isObjectPattern(splitNode.id) && t.isIdentifier(splitKey.node)) {
                 const matchingProperty = splitNode.id.properties.find((prop) => {
-                  return (
-                    t.isObjectProperty(prop) &&
-                    t.isIdentifier(prop.value) &&
-                    prop.value.name === splitKey.node.name
-                  )
+                  if (!t.isObjectProperty(prop)) {
+                    return false
+                  }
+
+                  if (t.isIdentifier(prop.value)) {
+                    return prop.value.name === splitKey.node.name
+                  }
+
+                  if (
+                    t.isAssignmentPattern(prop.value) &&
+                    t.isIdentifier(prop.value.left)
+                  ) {
+                    return prop.value.left.name === splitKey.node.name
+                  }
+
+                  return false
                 })
 
                 if (!matchingProperty) {
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx
index 45b35c5ca7..c81a2d2f46 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx
@@ -7,8 +7,11 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+const fallbackLoader = () => ({
+  message: 'fallback'
+});
 const {
-  loader
+  loader = fallbackLoader
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx
index f15a56deeb..16146d7345 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx
@@ -4,11 +4,13 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+function DefaultAboutComponent() {
+  return <div>Default About</div>;
+}
 const {
-  component: AboutComponent
+  component: AboutComponent = DefaultAboutComponent
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx
index 92a117a86e..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx
@@ -1 +0,0 @@
-import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx
index 92a117a86e..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx
@@ -1 +0,0 @@
-import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx
index 14b6198d2b..8f8f2fdb0b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx
@@ -1,3 +1,2 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
+import { AboutComponent } from "retain-exports-destructured.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx
index 96bcbe8e58..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx
@@ -1,2 +0,0 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx
index 96bcbe8e58..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx
@@ -1,2 +0,0 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
index f15a56deeb..16146d7345 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -4,11 +4,13 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+function DefaultAboutComponent() {
+  return <div>Default About</div>;
+}
 const {
-  component: AboutComponent
+  component: AboutComponent = DefaultAboutComponent
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx
index ae0fa6e2c2..ccb227a33e 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx
@@ -4,11 +4,13 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+const fallbackLoader = () => ({
+  message: 'fallback'
+});
 const {
-  loader
+  loader = fallbackLoader
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 14b6198d2b..8f8f2fdb0b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,2 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
+import { AboutComponent } from "retain-exports-destructured.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
index 496411052d..120a2e3911 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
@@ -1,3 +1,2 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
+import { loader } from "retain-exports-destructured.tsx";
 export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
index 033b36bcd6..f711c36696 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
@@ -4,13 +4,18 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+function DefaultAboutComponent() {
+  return <div>Default About</div>;
+}
+const fallbackLoader = () => ({
+  message: 'fallback'
+});
 const {
-  component: AboutComponent,
-  loader
+  component: AboutComponent = DefaultAboutComponent,
+  loader = fallbackLoader
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { loader };
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
index 92a117a86e..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
@@ -1 +0,0 @@
-import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
index 5ed998e5ed..b8ec44f220 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,4 +1,3 @@
 import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
 export { loader };
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
index 96bcbe8e58..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
@@ -1,2 +0,0 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx
index 96043ea61f..741d483e59 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export.tsx
@@ -7,8 +7,11 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+const fallbackLoader = () => ({
+  message: 'fallback'
+});
 const {
-  loader
+  loader = fallbackLoader
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx
index f15a56deeb..16146d7345 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@component.tsx
@@ -4,11 +4,13 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+function DefaultAboutComponent() {
+  return <div>Default About</div>;
+}
 const {
-  component: AboutComponent
+  component: AboutComponent = DefaultAboutComponent
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx
index 92a117a86e..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@errorComponent.tsx
@@ -1 +0,0 @@
-import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx
index 92a117a86e..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/destructured-export@notFoundComponent.tsx
@@ -1 +0,0 @@
-import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx
index 14b6198d2b..8f8f2fdb0b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@component.tsx
@@ -1,3 +1,2 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
+import { AboutComponent } from "retain-exports-destructured.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx
index 96bcbe8e58..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@errorComponent.tsx
@@ -1,2 +0,0 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx
index 96bcbe8e58..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/retain-exports-destructured@notFoundComponent.tsx
@@ -1,2 +0,0 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
index f15a56deeb..16146d7345 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -4,11 +4,13 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+function DefaultAboutComponent() {
+  return <div>Default About</div>;
+}
 const {
-  component: AboutComponent
+  component: AboutComponent = DefaultAboutComponent
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx
index ae0fa6e2c2..ccb227a33e 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/destructured-export@loader.tsx
@@ -4,11 +4,13 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+const fallbackLoader = () => ({
+  message: 'fallback'
+});
 const {
-  loader
+  loader = fallbackLoader
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
index 14b6198d2b..8f8f2fdb0b 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx
@@ -1,3 +1,2 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
+import { AboutComponent } from "retain-exports-destructured.tsx";
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
index 496411052d..120a2e3911 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx
@@ -1,3 +1,2 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
+import { loader } from "retain-exports-destructured.tsx";
 export { loader };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
index 033b36bcd6..f711c36696 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx
@@ -4,13 +4,18 @@ const createBits = () => ({
     message: 'hello'
   })
 });
+function DefaultAboutComponent() {
+  return <div>Default About</div>;
+}
+const fallbackLoader = () => ({
+  message: 'fallback'
+});
 const {
-  component: AboutComponent,
-  loader
+  component: AboutComponent = DefaultAboutComponent,
+  loader = fallbackLoader
 } = createBits();
 function AboutComponentImpl() {
   return <div>About</div>;
 }
-import { Route } from "destructured-export.tsx";
 export { loader };
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
index 92a117a86e..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx
@@ -1 +0,0 @@
-import { Route } from "destructured-export.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
index 5ed998e5ed..b8ec44f220 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx
@@ -1,4 +1,3 @@
 import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
 export { loader };
 export { AboutComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
index 96bcbe8e58..e69de29bb2 100644
--- a/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
+++ b/packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx
@@ -1,2 +0,0 @@
-import { AboutComponent, loader } from "retain-exports-destructured.tsx";
-import { Route } from "retain-exports-destructured.tsx";
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx
index 5ee98ab482..d543e96e7d 100644
--- a/packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx
+++ b/packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx
@@ -7,7 +7,15 @@ const createBits = () => ({
   }),
 })
 
-const { component: AboutComponent, loader } = createBits()
+function DefaultAboutComponent() {
+  return <div>Default About</div>
+}
+
+const fallbackLoader = () => ({
+  message: 'fallback',
+})
+
+const { component: AboutComponent = DefaultAboutComponent, loader = fallbackLoader } = createBits()
 
 function AboutComponentImpl() {
   return <div>About</div>
diff --git a/packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx b/packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx
index 3f723123b0..b6523ec16c 100644
--- a/packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx
+++ b/packages/router-plugin/tests/code-splitter/test-files/solid/destructured-export.tsx
@@ -7,7 +7,15 @@ const createBits = () => ({
   }),
 })
 
-const { component: AboutComponent, loader } = createBits()
+function DefaultAboutComponent() {
+  return <div>Default About</div>
+}
+
+const fallbackLoader = () => ({
+  message: 'fallback',
+})
+
+const { component: AboutComponent = DefaultAboutComponent, loader = fallbackLoader } = createBits()
 
 function AboutComponentImpl() {
   return <div>About</div>
