Skip to content

Layout-only parallel slot routes are skipped by prerender/static export #1052

@NathanDrake2406

Description

@NathanDrake2406

Summary

Routes that have a layout.tsx (with parallel slots) but no page.tsx are currently skipped by the prerender phase, so they are never statically exported. This affects ALL layout-only routes — it is not a new regression.

Details

In build/prerender.ts, line 849, any route with !route.pagePath is skipped:

if (!route.pagePath) continue;

This means routes like:

  • /parallel-nested/home (has layout.tsx + @parallelB/default.tsx, no page.tsx)
  • /slot-collision (has layout.tsx + @modal/default.tsx, no page.tsx)

...work correctly in dev/SSR but are silently omitted from static export (output: 'export').

Why this matters

Next.js supports layout.tsx + @slot/page.tsx patterns where the parent segment has no explicit page.tsx (the slot provides the content). These routes should still be prerenderable if the slot sub-pages are static.

Root cause

The classifyAppRoute function and the prerender loop both key off route.pagePath (the children slot). They do not consider whether parallel slot pages exist that could serve as the renderable content for static generation.

Potential fix

Teach classifyAppRoute and the prerender loop to recognize layout-only routes that have at least one parallel slot with a pagePath as renderable. The synthetic sub-routes created by discoverSlotSubRoutes already have slot pagePath populated — prerender just needs to look at the slots when route.pagePath is null.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions