Skip to content

Commit 5b74ca8

Browse files
fix: better error message in router generator (#4538)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent eb28ad0 commit 5b74ca8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/router-generator/src/transform/default-transform-plugin.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import type { TransformImportsConfig, TransformPlugin } from './types'
44

55
const b = types.builders
66

7+
const EXPORT_NAME = 'Route'
78
export const defaultTransformPlugin: TransformPlugin = {
89
name: 'default-transform',
9-
exportName: 'Route',
10+
exportName: EXPORT_NAME,
1011
imports: (ctx) => {
1112
const imports: TransformImportsConfig = {}
1213
const targetModule = `@tanstack/${ctx.target}-router`
@@ -87,7 +88,9 @@ export const defaultTransformPlugin: TransformPlugin = {
8788
}
8889
}
8990
if (identifier === undefined) {
90-
throw new Error(`expected identifier to be present`)
91+
throw new Error(
92+
`expected identifier to be present in ${ctx.routeId} for export ${EXPORT_NAME}`,
93+
)
9194
}
9295
if (identifier.name === 'createFileRoute' && ctx.lazy) {
9396
identifier.name = 'createLazyFileRoute'

0 commit comments

Comments
 (0)