Skip to content

Commit 7cbcea3

Browse files
authored
Remove duplicate standalone check (#60085)
## What? I noticed this check is already in a block that does the exact same check, so this one is no longer needed. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Closes NEXT-1929
1 parent 5071fca commit 7cbcea3

File tree

1 file changed

+48
-50
lines changed

1 file changed

+48
-50
lines changed

packages/next/src/build/index.ts

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3046,58 +3046,56 @@ export default async function build(
30463046
staticPages
30473047
)
30483048

3049-
if (config.output === 'standalone') {
3050-
for (const file of [
3051-
...requiredServerFiles.files,
3052-
path.join(config.distDir, SERVER_FILES_MANIFEST),
3053-
...loadedEnvFiles.reduce<string[]>((acc, envFile) => {
3054-
if (['.env', '.env.production'].includes(envFile.path)) {
3055-
acc.push(envFile.path)
3056-
}
3057-
return acc
3058-
}, []),
3059-
]) {
3060-
const filePath = path.join(dir, file)
3061-
const outputPath = path.join(
3062-
distDir,
3063-
'standalone',
3064-
path.relative(outputFileTracingRoot, filePath)
3065-
)
3066-
await fs.mkdir(path.dirname(outputPath), {
3067-
recursive: true,
3068-
})
3069-
await fs.copyFile(filePath, outputPath)
3070-
}
3071-
await recursiveCopy(
3072-
path.join(distDir, SERVER_DIRECTORY, 'pages'),
3073-
path.join(
3074-
distDir,
3075-
'standalone',
3076-
path.relative(outputFileTracingRoot, distDir),
3077-
SERVER_DIRECTORY,
3078-
'pages'
3079-
),
3080-
{ overwrite: true }
3049+
for (const file of [
3050+
...requiredServerFiles.files,
3051+
path.join(config.distDir, SERVER_FILES_MANIFEST),
3052+
...loadedEnvFiles.reduce<string[]>((acc, envFile) => {
3053+
if (['.env', '.env.production'].includes(envFile.path)) {
3054+
acc.push(envFile.path)
3055+
}
3056+
return acc
3057+
}, []),
3058+
]) {
3059+
const filePath = path.join(dir, file)
3060+
const outputPath = path.join(
3061+
distDir,
3062+
'standalone',
3063+
path.relative(outputFileTracingRoot, filePath)
30813064
)
3082-
if (appDir) {
3083-
const originalServerApp = path.join(
3084-
distDir,
3085-
SERVER_DIRECTORY,
3086-
'app'
3065+
await fs.mkdir(path.dirname(outputPath), {
3066+
recursive: true,
3067+
})
3068+
await fs.copyFile(filePath, outputPath)
3069+
}
3070+
await recursiveCopy(
3071+
path.join(distDir, SERVER_DIRECTORY, 'pages'),
3072+
path.join(
3073+
distDir,
3074+
'standalone',
3075+
path.relative(outputFileTracingRoot, distDir),
3076+
SERVER_DIRECTORY,
3077+
'pages'
3078+
),
3079+
{ overwrite: true }
3080+
)
3081+
if (appDir) {
3082+
const originalServerApp = path.join(
3083+
distDir,
3084+
SERVER_DIRECTORY,
3085+
'app'
3086+
)
3087+
if (existsSync(originalServerApp)) {
3088+
await recursiveCopy(
3089+
originalServerApp,
3090+
path.join(
3091+
distDir,
3092+
'standalone',
3093+
path.relative(outputFileTracingRoot, distDir),
3094+
SERVER_DIRECTORY,
3095+
'app'
3096+
),
3097+
{ overwrite: true }
30873098
)
3088-
if (existsSync(originalServerApp)) {
3089-
await recursiveCopy(
3090-
originalServerApp,
3091-
path.join(
3092-
distDir,
3093-
'standalone',
3094-
path.relative(outputFileTracingRoot, distDir),
3095-
SERVER_DIRECTORY,
3096-
'app'
3097-
),
3098-
{ overwrite: true }
3099-
)
3100-
}
31013099
}
31023100
}
31033101
})

0 commit comments

Comments
 (0)