diff --git a/.changeset/cold-icons-lick.md b/.changeset/cold-icons-lick.md new file mode 100644 index 0000000..d514352 --- /dev/null +++ b/.changeset/cold-icons-lick.md @@ -0,0 +1,5 @@ +--- +'rsbuild-plugin-react-router': patch +--- + +search for routes file with any extention diff --git a/.changeset/social-flowers-itch.md b/.changeset/social-flowers-itch.md new file mode 100644 index 0000000..30f70c8 --- /dev/null +++ b/.changeset/social-flowers-itch.md @@ -0,0 +1,5 @@ +--- +'rsbuild-plugin-react-router': patch +--- + +support multiple extentions for routes file, like js,ts,jsx etc diff --git a/src/index.ts b/src/index.ts index f2ce36a..d5e0b3d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -97,7 +97,7 @@ export const pluginReactRouter = ( return {} as Config; }); - const routesPath = resolve(appDirectory, 'routes.ts'); + const routesPath = findEntryFile(resolve(appDirectory, 'routes')); // Then read the routes const routeConfig = await jiti @@ -105,8 +105,8 @@ export const pluginReactRouter = ( default: true, }) .catch(error => { - console.error('Failed to load routes.ts:', error); - console.error('No routes.ts found in app directory.'); + console.error('Failed to load routes file:', error); + console.error('No routes file found in app directory.'); return [] as RouteConfigEntry[]; });