diff --git a/.changeset/shy-eels-drum.md b/.changeset/shy-eels-drum.md new file mode 100644 index 0000000000..2c325638fa --- /dev/null +++ b/.changeset/shy-eels-drum.md @@ -0,0 +1,5 @@ +--- +"@react-router/dev": patch +--- + +Typegen: only register route module types for routes within the app directory diff --git a/contributors.yml b/contributors.yml index 0b1dee6722..7b0c1b6f4b 100644 --- a/contributors.yml +++ b/contributors.yml @@ -117,6 +117,7 @@ - ericschn - esadek - faergeek +- fernandojbf - FilipJirsak - focusotter - foxscotch diff --git a/integration/typegen-test.ts b/integration/typegen-test.ts index 9ffcc5e183..01664a296a 100644 --- a/integration/typegen-test.ts +++ b/integration/typegen-test.ts @@ -456,6 +456,31 @@ test.describe("typegen", () => { await $("pnpm typecheck"); }); + test("route files with paths outside of app directory", async ({ + cwd, + edit, + $, + }) => { + await fs.mkdir(Path.join(cwd, "node_modules/external_dependency"), { + recursive: true, + }); + await edit({ + "app/routes.ts": tsx` + import { type RouteConfig, route } from "@react-router/dev/routes"; + + export default [ + route("outside/:id", "../node_modules/external_dependency/index.js"), + ] satisfies RouteConfig; + `, + "node_modules/external_dependency/index.js": tsx` + export default function Component() { + return