Repository: TanStack/router
Pull request #3318 (2025-02-03 20:54:25)

fix: peer dependencies
With these peer dependencies declared, Yarn PnP correctly stores one version of each tanstack package.
Without each one of these additions, yarn will duplicate one or more tanstack packages.
Which leads to context problems like #2540

nx-cloud[bot]: 
View your [CI Pipeline Execution ↗](https://cloud.nx.app/cipes/67a13c7a37a3c345af697035?utm_source=pull-request&utm_medium=comment) for commit ff67833f5d597e8d6ffed2d9829b14aa389f11b5.

---

☁️ [Nx Cloud](https://cloud.nx.app?utm_source=pull-request&utm_medium=comment) last updated this comment at `2025-02-03 22:00:26` UTC

<!-- NX_CLOUD_APP_COMMENT_END -->
nx-cloud[bot]: 
View your [CI Pipeline Execution ↗](https://cloud.nx.app/cipes/67a13c7a37a3c345af697035?utm_source=pull-request&utm_medium=comment) for commit ff67833f5d597e8d6ffed2d9829b14aa389f11b5.

---

☁️ [Nx Cloud](https://cloud.nx.app?utm_source=pull-request&utm_medium=comment) last updated this comment at `2025-02-03 22:00:26` UTC

<!-- NX_CLOUD_APP_COMMENT_END -->
pkg-pr-new[bot]: 
[Open in Stackblitz](https://pkg.pr.new/template/a2bfc60e-d938-4be5-a87b-136af7630f84)
<details><summary><b>More templates</b></summary><p>

- [tanstack-router-react-example-authenticated-routes](https://pkg.pr.new/template/299cf1cf-3b98-402c-8634-d1f035e6e94e)
- [tanstack-router-react-example-basic](https://pkg.pr.new/template/8dce3b6e-f64c-4454-a3e1-a7b894e1904c)
- [tanstack-router-react-example-basic-default-search-params](https://pkg.pr.new/template/8a4af097-43bf-4b3d-96c5-4097febdde4e)
- [tanstack-router-react-example-basic-file-based](https://pkg.pr.new/template/ee26b8b7-425d-408b-86c2-67569acb2361)
- [tanstack-router-react-example-basic-file-based-codesplitting](https://pkg.pr.new/template/12249c6c-9022-424b-8ca7-2f1d248e982d)
- [tanstack-router-react-example-basic-react-query-file-based](https://pkg.pr.new/template/14600197-8c5b-4cce-8ee2-19ed87b6372f)
- [tanstack-router-react-example-react-query](https://pkg.pr.new/template/2cad73ca-5486-4014-9333-7ded6a59c3b9)
- [tanstack-router-react-example-basic-ssr-streaming-file-based](https://pkg.pr.new/template/a423e36f-eab0-435e-acea-65f02c920394)
- [tanstack-router-react-example-basic-virtual-file-based](https://pkg.pr.new/template/16946fb8-37d4-43e1-b089-f30c55657e9a)
- [tanstack-router-react-example-basic-ssr-file-based](https://pkg.pr.new/template/345afb69-8e40-4a95-9473-4f401bcfbe92)
- [tanstack-router-react-example-deferred-data](https://pkg.pr.new/template/7afd0715-911e-4f41-9067-a337e3627ff0)
- [tanstack-router-react-example-basic-virtual-inside-file-based](https://pkg.pr.new/template/d6f4f0b6-bb8b-408c-9d9c-000907a12f0b)
- [tanstack-router-react-example-kitchen-sink](https://pkg.pr.new/template/a7429738-7a22-4848-87dc-71eaa1f7bd2b)
- [tanstack-router-react-example-kitchen-sink-react-query](https://pkg.pr.new/template/d571d84f-8e94-4df8-93c0-ede73cf7b18a)
- [tanstack-router-react-example-kitchen-sink-file-based](https://pkg.pr.new/template/081075cf-0bd4-4fb9-a673-a7d99c039210)
- [tanstack-router-react-example-kitchen-sink-react-query-file-based](https://pkg.pr.new/template/c4eeb318-0d22-4c41-a6b3-5481337d3c2e)
- [tanstack-router-react-example-large-file-based](https://pkg.pr.new/template/28df3ca4-22da-4bc2-bb77-8280dd880d44)
- [tanstack-router-react-example-location-masking](https://pkg.pr.new/template/7e143ff0-6c42-43e0-9dd2-dba217687081)
- [tanstack-router-react-example-navigation-blocking](https://pkg.pr.new/template/115c596f-23bc-473d-bc5b-5bab501ef02b)
- [tanstack-router-react-example-quickstart](https://pkg.pr.new/template/060fe122-4e66-4624-bf9e-c4de98ea46b3)
- [tanstack-router-react-example-quickstart-esbuild-file-based](https://pkg.pr.new/template/c76801d5-c869-45b3-838f-834ef6e9ecfb)
- [tanstack-router-react-example-quickstart-file-based](https://pkg.pr.new/template/ed1b4d5e-5acc-41ef-9ca4-fb2df0171a38)
- [tanstack-router-react-example-quickstart-rspack-file-based](https://pkg.pr.new/template/85fb4041-713a-465c-80f7-5a2e761c4ada)
- [tanstack-router-react-example-quickstart-webpack-file-based](https://pkg.pr.new/template/cec912a7-7633-4715-b2f9-e55ec278b1e6)
- [router-monorepo-react-query](https://pkg.pr.new/template/32b43d83-bec7-4bb9-8f96-e1617dfdca19)
- [router-mono-simple](https://pkg.pr.new/template/da8e1857-1be2-4d6e-8ac5-b23d6b3208ab)
- [router-mono-simple-lazy](https://pkg.pr.new/template/6fa073e5-6c19-4e2f-a2ab-cd2fe32e9bad)
- [tanstack-router-react-example-scroll-restoration](https://pkg.pr.new/template/cab912ee-e249-430d-9ca0-2d2e7e06369b)
- [tanstack-search-validator-adapters](https://pkg.pr.new/template/8ef538a9-a23e-4273-a8e4-a8330eeebb14)
- [tanstack-start-example-basic](https://pkg.pr.new/template/c57959d0-5bea-4634-969a-90747cfae05a)
- [tanstack-start-example-basic-auth](https://pkg.pr.new/template/6bac1f28-e0eb-4d8f-9951-10013e432b92)
- [tanstack-start-example-basic-react-query](https://pkg.pr.new/template/898513d5-934c-4095-b453-b815e411b554)
- [tanstack-start-example-basic-rsc](https://pkg.pr.new/template/214c2220-5602-4b89-bd57-1c9c5c076ef7)
- [tanstack-start-example-clerk-basic](https://pkg.pr.new/template/dc3b3ffb-f2a4-4498-9e2d-70f333deb23b)
- [tanstack-start-example-convex-trellaux](https://pkg.pr.new/template/38ab7b59-f71b-4ec2-ac83-5ef9eb0c3e82)
- [tanstack-start-example-counter](https://pkg.pr.new/template/a046e32b-66db-4dc4-b865-2671783537e1)
- [tanstack-start-example-large](https://pkg.pr.new/template/c1b5f996-8f55-45d1-9bb2-792e45e4eac8)
- [tanstack-start-example-supabase-basic](https://pkg.pr.new/template/e957f068-0b38-4fe0-a83b-bee67a2a0d91)
- [tanstack-start-example-trellaux](https://pkg.pr.new/template/8384a2ac-7314-4d14-8dd3-41125575bdd8)
- [tanstack-router-react-example-with-framer-motion](https://pkg.pr.new/template/8e199d42-ce59-44f8-be72-33531e761814)
- [tanstack-router-react-example-with-trpc](https://pkg.pr.new/template/ac6b5be2-af8c-482b-b61b-b1a8cbe67138)
- [tanstack-router-react-example-with-trpc-react-query](https://pkg.pr.new/template/ede872ae-284a-4af5-996d-13df4a5838aa)

</p></details>
      
    


<details><summary><b>@tanstack/arktype-adapter</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/arktype-adapter@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/create-start</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/create-start@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/directive-functions-plugin</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/directive-functions-plugin@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/create-router</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/create-router@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/eslint-plugin-router</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/history</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/history@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/react-cross-context</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/react-cross-context@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/react-router-with-query</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/react-router-with-query@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/router-cli</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/router-cli@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/react-router</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/react-router@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/router-core</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/router-core@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/router-devtools</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/router-devtools@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/router-generator</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/router-generator@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/router-plugin</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/router-plugin@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/router-utils</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/router-utils@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/router-vite-plugin</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/router-vite-plugin@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/server-functions-plugin</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/server-functions-plugin@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-api-routes</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-api-routes@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-client</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-client@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-config</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-config@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-plugin</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-plugin@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-router-manifest</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-router-manifest@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-server</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-server@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-server-functions-client</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-server-functions-client@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-server-functions-fetcher</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-server-functions-fetcher@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-server-functions-handler</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-server-functions-handler@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-server-functions-server</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-server-functions-server@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/start-server-functions-ssr</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/start-server-functions-ssr@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/valibot-adapter</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/valibot-adapter@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/virtual-file-routes</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/virtual-file-routes@3318
```

</p></details>
      
    

<details><summary><b>@tanstack/zod-adapter</b></summary><p>

```
npm i https://pkg.pr.new/@tanstack/zod-adapter@3318
```

</p></details>
      
    

_commit: <a href="https://github.com/TanStack/router/runs/36615464241"><code>ff67833</code></a>_

CarsonF: @schiller-manuel That PR test failure isn't related to my change right?
schiller-manuel: no this is not related, CI was somehow broken. fixed that now

Patch:
diff --git a/examples/react/basic-ssr-file-based/package.json b/examples/react/basic-ssr-file-based/package.json
index 741165a62..70db11370 100644
--- a/examples/react/basic-ssr-file-based/package.json
+++ b/examples/react/basic-ssr-file-based/package.json
@@ -14,7 +14,7 @@
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
     "@tanstack/router-plugin": "^1.99.3",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "get-port": "^7.1.0",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
diff --git a/examples/react/basic-ssr-streaming-file-based/package.json b/examples/react/basic-ssr-streaming-file-based/package.json
index ef3fee311..1562d6b00 100644
--- a/examples/react/basic-ssr-streaming-file-based/package.json
+++ b/examples/react/basic-ssr-streaming-file-based/package.json
@@ -14,7 +14,7 @@
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
     "@tanstack/router-plugin": "^1.99.3",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "get-port": "^7.1.0",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
diff --git a/examples/react/start-basic-auth/package.json b/examples/react/start-basic-auth/package.json
index e6a3e23a0..00f37ac75 100644
--- a/examples/react/start-basic-auth/package.json
+++ b/examples/react/start-basic-auth/package.json
@@ -13,7 +13,7 @@
     "@prisma/client": "5.22.0",
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "prisma": "^5.22.0",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
diff --git a/examples/react/start-basic-react-query/package.json b/examples/react/start-basic-react-query/package.json
index 8ec5c167b..570ba4f9a 100644
--- a/examples/react/start-basic-react-query/package.json
+++ b/examples/react/start-basic-react-query/package.json
@@ -14,7 +14,7 @@
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/react-router-with-query": "^1.99.3",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/start-basic-rsc/package.json b/examples/react/start-basic-rsc/package.json
index faab606bd..3546f1078 100644
--- a/examples/react/start-basic-rsc/package.json
+++ b/examples/react/start-basic-rsc/package.json
@@ -12,7 +12,7 @@
     "@babel/plugin-syntax-typescript": "^7.25.9",
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/start-basic/package.json b/examples/react/start-basic/package.json
index 700f734d3..6645c45e7 100644
--- a/examples/react/start-basic/package.json
+++ b/examples/react/start-basic/package.json
@@ -11,7 +11,7 @@
   "dependencies": {
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/start-clerk-basic/package.json b/examples/react/start-clerk-basic/package.json
index 9014c5aa8..2ed6f886a 100644
--- a/examples/react/start-clerk-basic/package.json
+++ b/examples/react/start-clerk-basic/package.json
@@ -12,7 +12,7 @@
     "@clerk/tanstack-start": "0.9.2",
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/start-convex-trellaux/package.json b/examples/react/start-convex-trellaux/package.json
index ff72255d8..d25208759 100644
--- a/examples/react/start-convex-trellaux/package.json
+++ b/examples/react/start-convex-trellaux/package.json
@@ -17,7 +17,7 @@
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/react-router-with-query": "^1.99.3",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "concurrently": "^8.2.2",
     "convex": "^1.18.2",
     "ky": "^1.7.4",
diff --git a/examples/react/start-counter/package.json b/examples/react/start-counter/package.json
index 4b096006d..01ea74d36 100644
--- a/examples/react/start-counter/package.json
+++ b/examples/react/start-counter/package.json
@@ -10,7 +10,7 @@
   },
   "dependencies": {
     "@tanstack/react-router": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
     "vinxi": "0.5.1"
diff --git a/examples/react/start-large/package.json b/examples/react/start-large/package.json
index ac536cbd7..2def206aa 100644
--- a/examples/react/start-large/package.json
+++ b/examples/react/start-large/package.json
@@ -14,7 +14,7 @@
     "@tanstack/react-query": "^5.66.0",
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
     "redaxios": "^0.5.1",
diff --git a/examples/react/start-supabase-basic/package.json b/examples/react/start-supabase-basic/package.json
index 7ae36eedf..639a12767 100644
--- a/examples/react/start-supabase-basic/package.json
+++ b/examples/react/start-supabase-basic/package.json
@@ -17,7 +17,7 @@
     "@supabase/supabase-js": "^2.48.1",
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "react": "^19.0.0",
     "react-dom": "^19.0.0",
     "vinxi": "0.5.1"
diff --git a/examples/react/start-trellaux/package.json b/examples/react/start-trellaux/package.json
index 188a806d4..32c6c6896 100644
--- a/examples/react/start-trellaux/package.json
+++ b/examples/react/start-trellaux/package.json
@@ -14,7 +14,7 @@
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/react-router-with-query": "^1.99.3",
     "@tanstack/router-devtools": "^1.99.0",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "ky": "^1.7.4",
     "msw": "^2.7.0",
     "react": "^19.0.0",
diff --git a/examples/react/with-trpc-react-query/package.json b/examples/react/with-trpc-react-query/package.json
index 926c576e8..ef1c42c5b 100644
--- a/examples/react/with-trpc-react-query/package.json
+++ b/examples/react/with-trpc-react-query/package.json
@@ -13,7 +13,7 @@
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
     "@tanstack/router-plugin": "^1.99.3",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "@trpc/client": "11.0.0-rc.730",
     "@trpc/react-query": "11.0.0-rc.730",
     "@trpc/server": "11.0.0-rc.730",
diff --git a/examples/react/with-trpc/package.json b/examples/react/with-trpc/package.json
index 57be78e19..d9ae92c16 100644
--- a/examples/react/with-trpc/package.json
+++ b/examples/react/with-trpc/package.json
@@ -11,7 +11,7 @@
     "@tanstack/react-router": "^1.99.0",
     "@tanstack/router-devtools": "^1.99.0",
     "@tanstack/router-plugin": "^1.99.3",
-    "@tanstack/start": "^1.99.3",
+    "@tanstack/start": "^1.99.4",
     "@trpc/client": "11.0.0-rc.730",
     "@trpc/server": "11.0.0-rc.730",
     "react": "^19.0.0",
diff --git a/packages/create-start/package.json b/packages/create-start/package.json
index 3858240a0..2cc213b62 100644
--- a/packages/create-start/package.json
+++ b/packages/create-start/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/create-start",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tim O'Connell",
   "license": "MIT",
diff --git a/packages/directive-functions-plugin/src/compilers.ts b/packages/directive-functions-plugin/src/compilers.ts
index 168d691bb..b359616a7 100644
--- a/packages/directive-functions-plugin/src/compilers.ts
+++ b/packages/directive-functions-plugin/src/compilers.ts
@@ -104,6 +104,7 @@ export function compileDirectives(opts: CompileDirectivesOpts): {
   const compiledResult = generateFromAst(ast, {
     sourceMaps: true,
     sourceFileName: opts.filename,
+    filename: opts.filename,
   })
 
   return {
diff --git a/packages/router-plugin/package.json b/packages/router-plugin/package.json
index cb29f212c..92f4f709f 100644
--- a/packages/router-plugin/package.json
+++ b/packages/router-plugin/package.json
@@ -122,6 +122,7 @@
   },
   "peerDependencies": {
     "@rsbuild/core": ">=1.0.2",
+    "@tanstack/react-router": "workspace:^",
     "vite": ">=5.0.0 || >=6.0.0",
     "webpack": ">=5.92.0"
   },
@@ -129,6 +130,9 @@
     "@rsbuild/core": {
       "optional": true
     },
+    "@tanstack/react-router": {
+      "optional": true
+    },
     "vite": {
       "optional": true
     },
diff --git a/packages/router-plugin/src/core/code-splitter/compilers.ts b/packages/router-plugin/src/core/code-splitter/compilers.ts
index 22eaf82d3..7885f49da 100644
--- a/packages/router-plugin/src/core/code-splitter/compilers.ts
+++ b/packages/router-plugin/src/core/code-splitter/compilers.ts
@@ -315,6 +315,7 @@ export function compileCodeSplitReferenceRoute(
   return generateFromAst(ast, {
     sourceMaps: true,
     sourceFileName: opts.filename,
+    filename: opts.filename,
   })
 }
 
@@ -589,6 +590,7 @@ export function compileCodeSplitVirtualRoute(
   return generateFromAst(ast, {
     sourceMaps: true,
     sourceFileName: opts.filename,
+    filename: opts.filename,
   })
 }
 
diff --git a/packages/router-utils/src/ast.ts b/packages/router-utils/src/ast.ts
index 795eff0f7..fbf6d970d 100644
--- a/packages/router-utils/src/ast.ts
+++ b/packages/router-utils/src/ast.ts
@@ -1,5 +1,6 @@
 import { parse } from '@babel/parser'
 import _generate from '@babel/generator'
+import type { GeneratorOptions, GeneratorResult } from '@babel/generator'
 import type { ParseResult } from '@babel/parser'
 import type * as _babel_types from '@babel/types'
 
@@ -29,6 +30,17 @@ let generate = _generate
 if ('default' in generate) {
   generate = generate.default as typeof generate
 }
-
-export { generate as generateFromAst }
+type GenerateFromAstOptions = GeneratorOptions &
+  Required<Pick<GeneratorOptions, 'sourceFileName' | 'filename'>>
+export function generateFromAst(
+  ast: _babel_types.Node,
+  opts?: GenerateFromAstOptions,
+): GeneratorResult {
+  return generate(
+    ast,
+    opts
+      ? { importAttributesKeyword: 'with', sourceMaps: true, ...opts }
+      : undefined,
+  )
+}
 export type { GeneratorResult } from '@babel/generator'
diff --git a/packages/start-api-routes/package.json b/packages/start-api-routes/package.json
index 6c130515a..d1e146df6 100644
--- a/packages/start-api-routes/package.json
+++ b/packages/start-api-routes/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-api-routes",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
@@ -73,6 +73,7 @@
   },
   "peerDependencies": {
     "react": ">=18.0.0 || >=19.0.0",
-    "react-dom": ">=18.0.0 || >=19.0.0"
+    "react-dom": ">=18.0.0 || >=19.0.0",
+    "vite": "^6.0.0"
   }
 }
diff --git a/packages/start-client/package.json b/packages/start-client/package.json
index 5d0f01d6d..e37c8d233 100644
--- a/packages/start-client/package.json
+++ b/packages/start-client/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-client",
-  "version": "1.99.0",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/start-config/package.json b/packages/start-config/package.json
index 385b51db6..5eb202a63 100644
--- a/packages/start-config/package.json
+++ b/packages/start-config/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-config",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
@@ -67,6 +67,7 @@
   "devDependencies": {},
   "peerDependencies": {
     "react": ">=18.0.0 || >=19.0.0",
-    "react-dom": ">=18.0.0 || >=19.0.0"
+    "react-dom": ">=18.0.0 || >=19.0.0",
+    "vite": "^6.0.0"
   }
 }
diff --git a/packages/start-server-functions-client/package.json b/packages/start-server-functions-client/package.json
index cf89f7f63..69609fbe9 100644
--- a/packages/start-server-functions-client/package.json
+++ b/packages/start-server-functions-client/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-server-functions-client",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/start-server-functions-fetcher/package.json b/packages/start-server-functions-fetcher/package.json
index 71f988f12..c2c383ccb 100644
--- a/packages/start-server-functions-fetcher/package.json
+++ b/packages/start-server-functions-fetcher/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-server-functions-fetcher",
-  "version": "1.99.0",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/start-server-functions-handler/package.json b/packages/start-server-functions-handler/package.json
index 63a050b80..b24604e4a 100644
--- a/packages/start-server-functions-handler/package.json
+++ b/packages/start-server-functions-handler/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-server-functions-handler",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
@@ -74,6 +74,7 @@
   },
   "peerDependencies": {
     "react": ">=18.0.0 || >=19.0.0",
-    "react-dom": ">=18.0.0 || >=19.0.0"
+    "react-dom": ">=18.0.0 || >=19.0.0",
+    "vite": "^6.0.0"
   }
 }
diff --git a/packages/start-server-functions-ssr/package.json b/packages/start-server-functions-ssr/package.json
index 2b8462fa6..a18cb4929 100644
--- a/packages/start-server-functions-ssr/package.json
+++ b/packages/start-server-functions-ssr/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-server-functions-ssr",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
@@ -75,6 +75,7 @@
   },
   "peerDependencies": {
     "react": ">=18.0.0 || >=19.0.0",
-    "react-dom": ">=18.0.0 || >=19.0.0"
+    "react-dom": ">=18.0.0 || >=19.0.0",
+    "vite": "^6.0.0"
   }
 }
diff --git a/packages/start-server/package.json b/packages/start-server/package.json
index 75b413003..07c665f2d 100644
--- a/packages/start-server/package.json
+++ b/packages/start-server/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start-server",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
diff --git a/packages/start/package.json b/packages/start/package.json
index 58671ad39..a9bb4afe2 100644
--- a/packages/start/package.json
+++ b/packages/start/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@tanstack/start",
-  "version": "1.99.3",
+  "version": "1.99.4",
   "description": "Modern and scalable routing for React applications",
   "author": "Tanner Linsley",
   "license": "MIT",
@@ -152,6 +152,11 @@
     "@tanstack/start-server-functions-ssr": "workspace:^",
     "@tanstack/start-api-routes": "workspace:^"
   },
+  "peerDependencies": {
+    "react": ">=18.0.0 || >=19.0.0",
+    "react-dom": ">=18.0.0 || >=19.0.0",
+    "vite": "^6.0.0"
+  },
   "devDependencies": {
     "esbuild": "^0.24.2"
   }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d045ed319..1431d0db5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4328,6 +4328,9 @@ importers:
       '@rsbuild/core':
         specifier: '>=1.0.2'
         version: 1.2.3
+      '@tanstack/react-router':
+        specifier: workspace:*
+        version: link:../react-router
       '@tanstack/router-generator':
         specifier: workspace:*
         version: link:../router-generator
@@ -4473,6 +4476,15 @@ importers:
       '@tanstack/start-server-functions-ssr':
         specifier: workspace:*
         version: link:../start-server-functions-ssr
+      react:
+        specifier: ^19.0.0
+        version: 19.0.0
+      react-dom:
+        specifier: ^19.0.0
+        version: 19.0.0(react@19.0.0)
+      vite:
+        specifier: 6.0.11
+        version: 6.0.11(@types/node@22.13.0)(jiti@2.4.2)(terser@5.37.0)(tsx@4.19.2)(yaml@2.7.0)
     devDependencies:
       esbuild:
         specifier: ^0.24.2
@@ -4492,6 +4504,9 @@ importers:
       vinxi:
         specifier: 0.5.1
         version: 0.5.1(@types/node@22.13.0)(db0@0.2.3)(ioredis@5.4.2)(jiti@2.4.2)(terser@5.37.0)(tsx@4.19.2)(typescript@5.7.3)(yaml@2.7.0)
+      vite:
+        specifier: 6.0.11
+        version: 6.0.11(@types/node@22.13.0)(jiti@2.4.2)(terser@5.37.0)(tsx@4.19.2)(yaml@2.7.0)
     devDependencies:
       react:
         specifier: ^19.0.0
@@ -4759,6 +4774,9 @@ importers:
       tiny-invariant:
         specifier: ^1.3.3
         version: 1.3.3
+      vite:
+        specifier: 6.0.11
+        version: 6.0.11(@types/node@22.13.0)(jiti@2.4.2)(terser@5.37.0)(tsx@4.19.2)(yaml@2.7.0)
     devDependencies:
       react:
         specifier: ^19.0.0
@@ -4812,6 +4830,9 @@ importers:
       tiny-invariant:
         specifier: ^1.3.3
         version: 1.3.3
+      vite:
+        specifier: 6.0.11
+        version: 6.0.11(@types/node@22.13.0)(jiti@2.4.2)(terser@5.37.0)(tsx@4.19.2)(yaml@2.7.0)
     devDependencies:
       react:
         specifier: ^19.0.0


Test patch:
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/development/importAttribute.tsx b/packages/router-plugin/tests/code-splitter/snapshots/development/importAttribute.tsx
new file mode 100644
index 000000000..643100983
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/development/importAttribute.tsx
@@ -0,0 +1,9 @@
+const $$splitComponentImporter = () => import('importAttribute.tsx?tsr-split');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr)
+});
+export function TSRDummyComponent() {
+  return null;
+}
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/development/importAttribute@split.tsx b/packages/router-plugin/tests/code-splitter/snapshots/development/importAttribute@split.tsx
new file mode 100644
index 000000000..f34d3c640
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/development/importAttribute@split.tsx
@@ -0,0 +1,3 @@
+import { test } from './test' with { type: 'macro' };
+const SplitComponent = () => test;
+export { SplitComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/production/importAttribute.tsx b/packages/router-plugin/tests/code-splitter/snapshots/production/importAttribute.tsx
new file mode 100644
index 000000000..643100983
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/production/importAttribute.tsx
@@ -0,0 +1,9 @@
+const $$splitComponentImporter = () => import('importAttribute.tsx?tsr-split');
+import { lazyRouteComponent } from '@tanstack/react-router';
+import { createFileRoute } from '@tanstack/react-router';
+export const Route = createFileRoute('/')({
+  component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr)
+});
+export function TSRDummyComponent() {
+  return null;
+}
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/snapshots/production/importAttribute@split.tsx b/packages/router-plugin/tests/code-splitter/snapshots/production/importAttribute@split.tsx
new file mode 100644
index 000000000..f34d3c640
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/snapshots/production/importAttribute@split.tsx
@@ -0,0 +1,3 @@
+import { test } from './test' with { type: 'macro' };
+const SplitComponent = () => test;
+export { SplitComponent as component };
\ No newline at end of file
diff --git a/packages/router-plugin/tests/code-splitter/test-files/importAttribute.tsx b/packages/router-plugin/tests/code-splitter/test-files/importAttribute.tsx
new file mode 100644
index 000000000..9d406d390
--- /dev/null
+++ b/packages/router-plugin/tests/code-splitter/test-files/importAttribute.tsx
@@ -0,0 +1,7 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+import { test } from './test' with { type: 'macro' }
+
+export const Route = createFileRoute('/')({
+  component: () => test,
+})