File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' rsbuild-plugin-react-router ' : patch
3+ ---
4+
5+ Fix: Correctly expose routeDiscovery configuration for React Router v7 in Rspack builds.
Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ export const pluginReactRouter = (
9797 return { } as Config ;
9898 } ) ;
9999
100+ // Set default routeDiscovery configuration
101+ const routeDiscovery = { mode : 'lazy' , manifestPath : '/__manifest' } as const ;
102+
100103 const routesPath = findEntryFile ( resolve ( appDirectory , 'routes' ) ) ;
101104
102105 // Then read the routes
@@ -175,6 +178,7 @@ export const pluginReactRouter = (
175178 appDirectory,
176179 ssr,
177180 federation : options . federation ,
181+ routeDiscovery,
178182 } ) ,
179183 'virtual/react-router/with-props' : generateWithProps ( ) ,
180184 } ) ;
Original file line number Diff line number Diff line change @@ -12,6 +12,15 @@ function generateAsyncTemplate(
1212 basename : string ;
1313 appDirectory : string ;
1414 ssr : boolean ;
15+ routeDiscovery :
16+ | {
17+ mode : 'lazy' ;
18+ manifestPath ?: string ;
19+ }
20+ | {
21+ mode : 'initial' ;
22+ }
23+ | undefined ;
1524 }
1625) : string {
1726 return `
@@ -82,6 +91,7 @@ function generateAsyncTemplate(
8291 export const future = ${ JSON . stringify ( { } ) } ;
8392 export const isSpaMode = ${ ! options . ssr } ;
8493 export const ssr = ${ options . ssr } ;
94+ export const routeDiscovery = ${ JSON . stringify ( options . routeDiscovery ) } ;
8595 export const publicPath = "/";
8696 export const prerender = [];
8797 export const entry = { module: entryServer };
@@ -115,6 +125,15 @@ function generateStaticTemplate(
115125 basename : string ;
116126 appDirectory : string ;
117127 ssr : boolean ;
128+ routeDiscovery :
129+ | {
130+ mode : 'lazy' ;
131+ manifestPath ?: string ;
132+ }
133+ | {
134+ mode : 'initial' ;
135+ }
136+ | undefined ;
118137 }
119138) : string {
120139 return `
@@ -136,6 +155,7 @@ function generateStaticTemplate(
136155 export const future = ${ JSON . stringify ( { } ) } ;
137156 export const isSpaMode = ${ ! options . ssr } ;
138157 export const ssr = ${ options . ssr } ;
158+ export const routeDiscovery = ${ JSON . stringify ( options . routeDiscovery ) } ;
139159 export const prerender = [];
140160 export const publicPath = "/";
141161 export const entry = { module: entryServer };
@@ -173,6 +193,15 @@ function generateServerBuild(
173193 appDirectory : string ;
174194 ssr : boolean ;
175195 federation ?: boolean ;
196+ routeDiscovery :
197+ | {
198+ mode : 'lazy' ;
199+ manifestPath ?: string ;
200+ }
201+ | {
202+ mode : 'initial' ;
203+ }
204+ | undefined ;
176205 }
177206) : string {
178207 return options . federation
You can’t perform that action at this time.
0 commit comments