Skip to content

refactor: write pages router export files directly to server/pages/#90018

Draft
bgub wants to merge 1 commit intovercel:canaryfrom
bgub:fix/export-write-directly-to-server-pages
Draft

refactor: write pages router export files directly to server/pages/#90018
bgub wants to merge 1 commit intovercel:canaryfrom
bgub:fix/export-write-directly-to-server-pages

Conversation

@bgub
Copy link
Contributor

@bgub bgub commented Feb 15, 2026

Summary

  • write pages-router export artifacts directly into .next/server/pages during buildExport instead of writing to dist/export and moving afterward
  • simplify build finalization by updating pages-manifest entries directly and removing the export temp directory move/cleanup flow
  • keep prerender behavior aligned by deleting notFound artifacts from server/pages and pointing static export copy logic at the new pages-router output location

Instead of exporting pages to a temp directory and then moving them,
have the export worker write directly to .next/server/pages/. This
eliminates the moveExportedPage step and the temporary export folder.

- Replace moveExportedPage with updatePagesManifestForExportedPage
  (synchronous manifest-only updates, no file I/O)
- Redirect export worker outDir/pagesDataDir to server/pages/ during
  buildExport
- Skip outDir cleanup during buildExport (no temp dir created)
- Delete notFound i18n SSG files that the worker wrote but shouldn't
  be served
- Fix output:"export" copy step to read pages router files from
  server/pages/ directly instead of getPagePath-based paths
@bgub bgub changed the title fix: write pages router export files directly to server/pages/ refactor: write pages router export files directly to server/pages/ Feb 15, 2026
@nextjs-bot
Copy link
Collaborator

Allow CI Workflow Run

  • approve CI run for commit: 62ce036

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants