File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
packages/next/src/server/lib Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -583,13 +583,20 @@ export async function initialize(opts: {
583
583
} )
584
584
585
585
if ( opts . dev && developmentBundler && req . url ) {
586
- const isHMRRequest = req . url . includes ( '/_next/webpack-hmr' )
586
+ const { basePath } = config
587
+
588
+ const isHMRRequestForHostApp =
589
+ ! basePath && req . url . startsWith ( '/_next/webpack-hmr' )
590
+
591
+ const isHMRRequestForGuestApp =
592
+ basePath && pathHasPrefix ( req . url , basePath )
593
+
594
+ const isHMRRequestForCurrentBasepath =
595
+ isHMRRequestForHostApp || isHMRRequestForGuestApp
596
+
587
597
// only handle HMR requests if the basePath in the request
588
598
// matches the basePath for the handler responding to the request
589
- const isRequestForCurrentBasepath =
590
- ! config . basePath || pathHasPrefix ( req . url , config . basePath )
591
-
592
- if ( isHMRRequest && isRequestForCurrentBasepath ) {
599
+ if ( isHMRRequestForCurrentBasepath ) {
593
600
return developmentBundler . hotReloader . onHMR ( req , socket , head )
594
601
}
595
602
}
You can’t perform that action at this time.
0 commit comments