Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-icons-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rsbuild-plugin-react-router': patch
---

search for routes file with any extention
5 changes: 5 additions & 0 deletions .changeset/social-flowers-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rsbuild-plugin-react-router': patch
---

support multiple extentions for routes file, like js,ts,jsx etc
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ 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
.import<RouteConfigEntry[]>(routesPath, {
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[];
});

Expand Down