next.js: generateStaticParams() not detected when using parallel routes / dynamic routes using output: export
Link to the code that reproduces this issue
https://github.com/KoenLemmen/nextgramminimal/
To Reproduce
- Start application in dev mode (application won’t build with the same error)
- Go to localhost:3000/
- Click one of the “images”
- No modal opens
- Error happens:
Error: Page "/@modal/(.)photos/[id]/page" is missing exported function "generateStaticParams()", which is required with "output: export" config.
at DevServer.renderToResponseWithComponentsImpl (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\base-server.js:1071:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async DevServer.renderPageComponent (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\base-server.js:1913:24)
at async DevServer.renderToResponseImpl (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\base-server.js:1951:32)
at async DevServer.pipeImpl (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\base-server.js:911:25)
at async NextNodeServer.handleCatchallRenderRequest (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\next-server.js:272:17)
at async DevServer.handleRequestImpl (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\base-server.js:807:17)
at async C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\dev\next-dev-server.js:339:20
at async Span.traceAsyncFn (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\trace\trace.js:154:20)
at async DevServer.handleRequest (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\dev\next-dev-server.js:336:24)
at async invokeRender (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\lib\router-server.js:174:21)
at async handleRequest (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\lib\router-server.js:353:24)
at async requestHandlerImpl (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\lib\router-server.js:377:13)
at async Server.requestListener (C:\Users\koenl\Downloads\april\nextgram\node_modules\next\dist\server\lib\start-server.js:141:13) {
page: '/(.)photos/1'
- photos/[id] is opened instead of @modal/(.)photos/[id]
As can be seen in @modal/(.)photos/[id] the exported function is present.
Current vs. Expected behavior
Current behavior:
- Modal path errors and non modal path opens
- generateStaticParams() is not detected and used
Expected behavior:
- Modal path is opened
- Modal path uses generateStaticParams()
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Available memory (MB): 65463
Available CPU cores: 24
Binaries:
Node: 20.8.1
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 14.2.0-canary.51 // Latest available version is detected (14.2.0-canary.51).
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.4.3
Next.js Config:
output: export
Which area(s) are affected? (Select all that apply)
App Router, Data fetching (gS(S)P, getInitialProps), Static HTML Export (output: “export”)
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
Unsure but might be related to: https://github.com/vercel/next.js/issues/52842
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 16
- Comments: 26 (4 by maintainers)
I can confirm i am getting the same
app routerbug being thrown in the"next": "^15.0.3",version. Below is the error message in detail:Any workaround or help is appreciated. Thank you !
Hi all, thank you for the report!
Parallel routes should work fine with
output: export. And indeed, that erroneous build error should no longer be happening in latest versions. However, looking at the reproduction, the problem is specifically with interception routes. Interception routes are built on top of parallel routes, but they make use of rewrites to determine which page component should be rendered during a client navigation.Rewrites are one of the things that we’ve documented as not being supported by
output: "export"(ref) as they currently require a server to handle. However, it’s an oversight on our part that we do not explicitly document interception routes as being unsupported, and that we aren’t erroring when we detect interception route usage in an exported app.We’d like to support as many features as possible with
output: export, and have ideas on how to make this work in the future. I’ll leave this issue open until we can get proper documentation & feedback in dev that it’s not yet supported.If you aren’t interested in the interception behavior of modals, then you can implement the modal with a parallel route. Interception routes are only necessary if the goal is to show a different experience when performing a client navigation (eg soft nav) vs landing directly on the page. The former will show the interception route, the latter will show the underlying page component.
If you don’t need that behavior, then you’re able to implement the modal pattern with parallel routes and
output: export. However, if you need the deeplinking behavior, that’s where there’s additional complexity that currently requires a server to determine if, based on a particular request, it should serve Component A or Component B.Here’s an example: https://stackblitz.com/edit/nextjs-c5zar9uk?file=app%2Fpage.tsx And another with a visual example: https://x.com/asidorenko_/status/1725548472839950553?lang=en
I can’t really determine that from your message: it’d be best to open a new issue with a minimal reproduction if your case isn’t working, and you’re not using intercepting routes +
output: export.Any updates on resolving this bug? I am experiencing the same build errors related to my parallel intercepting routes with my static application that I build with next.config
output: "export".