Skip to content

Conversation

naaa760
Copy link

@naaa760 naaa760 commented Sep 29, 2025

What?

Fixed standalone build output paths to exclude workspace package names when using pnpm workspaces.

Why?

In Next.js 15.5.0+, when using output: 'standalone' with pnpm workspaces, the server.js file was incorrectly placed at .next/standalone/{package_name}/server.js instead of the expected .next/standalone/server.js. This broke existing deployment scripts and Docker configurations that expect the standard location.

How?

Modified the path calculation logic in two files:

  • packages/next/src/build/utils.ts: Fixed server.js and package.json paths in copyTracedFiles function

  • packages/next/src/build/index.ts: Fixed server.js path in writeStandaloneDirectory function and removed package name from middleware, pages, and app directory paths

  • The fix ensures core server files are placed directly in the standalone directory while preserving directory structure for other files.

Related Issues

@ijjk
Copy link
Member

ijjk commented Sep 29, 2025

Allow CI Workflow Run

  • approve CI run for commit: 74e5083

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.

Standalone build output path includes workspace package name in Next.js 15.5.0+ with pnpm workspace
2 participants