File tree Expand file tree Collapse file tree 5 files changed +23
-16
lines changed Expand file tree Collapse file tree 5 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -349,7 +349,9 @@ impl HmrBenchmark {
349
349
data_endpoint,
350
350
} => {
351
351
let _ = endpoint_write_to_disk ( * * html_endpoint) . await ?;
352
- let _ = endpoint_write_to_disk ( * * data_endpoint) . await ?;
352
+ if let Some ( data_endpoint) = data_endpoint {
353
+ let _ = endpoint_write_to_disk ( * * data_endpoint) . await ?;
354
+ }
353
355
}
354
356
next_api:: route:: Route :: PageApi { endpoint } => {
355
357
let _ = endpoint_write_to_disk ( * * endpoint) . await ?;
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ async fn pick_endpoint(
166
166
}
167
167
EndpointSelector :: RoutePageData ( name) => {
168
168
if let Some ( Route :: Page { data_endpoint, .. } ) = endpoints. routes . get ( & name) {
169
- Some ( * data_endpoint)
169
+ * data_endpoint
170
170
} else {
171
171
None
172
172
}
Original file line number Diff line number Diff line change @@ -199,18 +199,23 @@ impl PagesProject {
199
199
. to_resolved ( )
200
200
. await ?,
201
201
) ,
202
- data_endpoint : ResolvedVc :: upcast (
203
- PageEndpoint :: new (
204
- PageEndpointType :: Data ,
205
- self ,
206
- pathname,
207
- original_name,
208
- page,
209
- pages_structure,
210
- )
211
- . to_resolved ( )
212
- . await ?,
213
- ) ,
202
+ // The data endpoint is only needed in development mode to support HMR
203
+ data_endpoint : if self . project ( ) . next_mode ( ) . await ?. is_development ( ) {
204
+ Some ( ResolvedVc :: upcast (
205
+ PageEndpoint :: new (
206
+ PageEndpointType :: Data ,
207
+ self ,
208
+ pathname,
209
+ original_name,
210
+ page,
211
+ pages_structure,
212
+ )
213
+ . to_resolved ( )
214
+ . await ?,
215
+ ) )
216
+ } else {
217
+ None
218
+ } ,
214
219
} )
215
220
} )
216
221
} ;
Original file line number Diff line number Diff line change @@ -869,7 +869,7 @@ impl Project {
869
869
endpoints. push ( * html_endpoint) ;
870
870
// In development we want to include the data endpoint to support
871
871
// server side changes. See PACK
872
- if self . next_mode ( ) . await ? . is_development ( ) {
872
+ if let Some ( data_endpoint ) = data_endpoint {
873
873
endpoints. push ( * data_endpoint) ;
874
874
}
875
875
}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ pub struct AppPageRoute {
34
34
pub enum Route {
35
35
Page {
36
36
html_endpoint : ResolvedVc < Box < dyn Endpoint > > ,
37
- data_endpoint : ResolvedVc < Box < dyn Endpoint > > ,
37
+ data_endpoint : Option < ResolvedVc < Box < dyn Endpoint > > > ,
38
38
} ,
39
39
PageApi {
40
40
endpoint : ResolvedVc < Box < dyn Endpoint > > ,
You can’t perform that action at this time.
0 commit comments