Skip to content

Commit 7370b3d

Browse files
committed
fix: use only in directory routes on +routes RouteModules
1 parent 1abe213 commit 7370b3d

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.changeset/shy-eels-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-router/dev": patch
3+
---
4+
5+
use only in directory routes on +routes RouteModules

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
- ericschn
118118
- esadek
119119
- faergeek
120+
- fernandojbf
120121
- FilipJirsak
121122
- focusotter
122123
- foxscotch

packages/react-router-dev/typegen/generate.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,15 @@ function routeModulesType(ctx: Context) {
205205
t.tsPropertySignature(
206206
t.stringLiteral(route.id),
207207
t.tsTypeAnnotation(
208-
t.tsTypeQuery(
209-
t.tsImportType(
210-
t.stringLiteral(
211-
`./${Path.relative(ctx.rootDirectory, ctx.config.appDirectory)}/${route.file}`,
212-
),
213-
),
214-
),
208+
isInAppDirectory(ctx, route.file)
209+
? t.tsTypeQuery(
210+
t.tsImportType(
211+
t.stringLiteral(
212+
`./${Path.relative(ctx.rootDirectory, ctx.config.appDirectory)}/${route.file}`,
213+
),
214+
),
215+
)
216+
: t.tsUnknownKeyword(),
215217
),
216218
),
217219
),

0 commit comments

Comments
 (0)