Skip to content

Commit e17bdb0

Browse files
committed
Fix /index/index issue
1 parent f566e88 commit e17bdb0

File tree

1 file changed

+8
-1
lines changed
  • packages/next/src/build/webpack/loaders/next-app-loader

1 file changed

+8
-1
lines changed

packages/next/src/build/webpack/loaders/next-app-loader/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,14 @@ const nextAppLoader: AppLoader = async function nextAppLoader() {
682682

683683
const buildInfo = getModuleBuildInfo((this as any)._module)
684684
const collectedDeclarations: [string, string][] = []
685-
const page = name.replace(/^app/, '')
685+
686+
// Use the page from loaderOptions directly instead of deriving it from name.
687+
// The name (bundlePath) may have been normalized with normalizePagePath()
688+
// which is designed for Pages Router and incorrectly duplicates /index paths
689+
// (e.g., /index/page -> /index/index/page). The page parameter contains the
690+
// correct unnormalized value.
691+
const page = loaderOptions.page
692+
686693
const middlewareConfig: ProxyConfig = JSON.parse(
687694
Buffer.from(middlewareConfigBase64, 'base64').toString()
688695
)

0 commit comments

Comments
 (0)