File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
packages/next/src/server/dev Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -726,9 +726,12 @@ export function onDemandEntryHandler({
726726 const isInsideAppDir =
727727 ! ! appDir && pagePathData . absolutePagePath . startsWith ( appDir )
728728
729- if ( typeof isApp === 'boolean' && ! ( isApp === isInsideAppDir ) ) {
729+ if ( typeof isApp === 'boolean' && isApp !== isInsideAppDir ) {
730+ Error . stackTraceLimit = 15
730731 throw new Error (
731- 'Ensure bailed, found path does not match ensure type (pages/app)'
732+ `Ensure bailed, found path "${
733+ pagePathData . page
734+ } " does not match ensure type (${ isApp ? 'app' : 'pages' } )`
732735 )
733736 }
734737
@@ -912,7 +915,7 @@ export function onDemandEntryHandler({
912915 match ?: RouteMatch
913916 isApp ?: boolean
914917 } ) {
915- if ( curEnsurePage . has ( page ) ) {
918+ if ( typeof isApp !== 'boolean' && curEnsurePage . has ( page ) ) {
916919 return curEnsurePage . get ( page )
917920 }
918921 const promise = ensurePageImpl ( {
@@ -921,7 +924,12 @@ export function onDemandEntryHandler({
921924 appPaths,
922925 match,
923926 isApp,
924- } ) . finally ( ( ) => {
927+ } )
928+
929+ if ( typeof isApp === 'boolean' ) {
930+ return promise
931+ }
932+ promise . finally ( ( ) => {
925933 curEnsurePage . delete ( page )
926934 } )
927935 curEnsurePage . set ( page , promise )
You can’t perform that action at this time.
0 commit comments