Next.js并行路由

前端开发 2026-07-09

我在Next.js中使用并行路由,想让头部在路径相关的情况下具有或没有链接功能。但构建时,输出如下,我完全不理解它想表达什么:

> next build --webpack

▲ Next.js 16.1.6 (webpack)
- Environments: .env.local

  Creating an optimized production build ...
✓ (serwist) Bundling the service worker script with the URL '/sw.js' and the scope '/'...
✓ Compiled successfully in 5.2s
✓ Finished TypeScript in 10.4s    
  Collecting page data using 15 workers  ..global.console will be set to productionOrDebugConsole.
global.console will be set to productionOrDebugConsole.
global.console will be set to productionOrDebugConsole.
✓ Collecting page data using 15 workers in 1023.1ms    
  Generating static pages using 15 workers (0/53)  [=   ]global.console will be set to productionOrDebugConsole.
global.console will be set to productionOrDebugConsole.
global.console will be set to productionOrDebugConsole.
  Generating static pages using 15 workers (26/53)  [==  ]Error occurred prerendering page "/de/splitter3/superAdmin". Read more: https://nextjs.org/docs/messages/prerender-error
Error [InvariantError]: Invariant: The client reference manifest for route "/de/splitter3/superAdmin" does not exist. This is a bug in Next.js.
    at ignore-listed frames
Export encountered an error on /de/splitter3/(splitter3)/superAdmin/@headSuperAdmin/(superAdmin)/page: /de/splitter3/superAdmin, exiting the build.
⨯ Next.js build worker exited with code: 1 and signal: null

解决方案

原因在于我添加了.../@headSuperAdmin/page.tsx,以及.../@headSuperAdmin/(superAdmin)/page.tsx

我的初衷是让 (superAdmin)/page.tsx成为 (superAdmin) 下所有子文件夹的默认页面,但这个理解对我来说过于乐观了。

站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。

相关文章