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 = (
97
97
return { } as Config ;
98
98
} ) ;
99
99
100
+ // Set default routeDiscovery configuration
101
+ const routeDiscovery = { mode : 'lazy' , manifestPath : '/__manifest' } as const ;
102
+
100
103
const routesPath = findEntryFile ( resolve ( appDirectory , 'routes' ) ) ;
101
104
102
105
// Then read the routes
@@ -175,6 +178,7 @@ export const pluginReactRouter = (
175
178
appDirectory,
176
179
ssr,
177
180
federation : options . federation ,
181
+ routeDiscovery,
178
182
} ) ,
179
183
'virtual/react-router/with-props' : generateWithProps ( ) ,
180
184
} ) ;
Original file line number Diff line number Diff line change @@ -12,6 +12,15 @@ function generateAsyncTemplate(
12
12
basename : string ;
13
13
appDirectory : string ;
14
14
ssr : boolean ;
15
+ routeDiscovery :
16
+ | {
17
+ mode : 'lazy' ;
18
+ manifestPath ?: string ;
19
+ }
20
+ | {
21
+ mode : 'initial' ;
22
+ }
23
+ | undefined ;
15
24
}
16
25
) : string {
17
26
return `
@@ -82,6 +91,7 @@ function generateAsyncTemplate(
82
91
export const future = ${ JSON . stringify ( { } ) } ;
83
92
export const isSpaMode = ${ ! options . ssr } ;
84
93
export const ssr = ${ options . ssr } ;
94
+ export const routeDiscovery = ${ JSON . stringify ( options . routeDiscovery ) } ;
85
95
export const publicPath = "/";
86
96
export const prerender = [];
87
97
export const entry = { module: entryServer };
@@ -115,6 +125,15 @@ function generateStaticTemplate(
115
125
basename : string ;
116
126
appDirectory : string ;
117
127
ssr : boolean ;
128
+ routeDiscovery :
129
+ | {
130
+ mode : 'lazy' ;
131
+ manifestPath ?: string ;
132
+ }
133
+ | {
134
+ mode : 'initial' ;
135
+ }
136
+ | undefined ;
118
137
}
119
138
) : string {
120
139
return `
@@ -136,6 +155,7 @@ function generateStaticTemplate(
136
155
export const future = ${ JSON . stringify ( { } ) } ;
137
156
export const isSpaMode = ${ ! options . ssr } ;
138
157
export const ssr = ${ options . ssr } ;
158
+ export const routeDiscovery = ${ JSON . stringify ( options . routeDiscovery ) } ;
139
159
export const prerender = [];
140
160
export const publicPath = "/";
141
161
export const entry = { module: entryServer };
@@ -173,6 +193,15 @@ function generateServerBuild(
173
193
appDirectory : string ;
174
194
ssr : boolean ;
175
195
federation ?: boolean ;
196
+ routeDiscovery :
197
+ | {
198
+ mode : 'lazy' ;
199
+ manifestPath ?: string ;
200
+ }
201
+ | {
202
+ mode : 'initial' ;
203
+ }
204
+ | undefined ;
176
205
}
177
206
) : string {
178
207
return options . federation
You can’t perform that action at this time.
0 commit comments