From aa622bab5abc239a9b51ebcf8cda8b1582cae530 Mon Sep 17 00:00:00 2001 From: Nicholas Cunningham Date: Wed, 7 Feb 2024 16:16:39 -0700 Subject: [PATCH] fix(nextjs): src package.json should not be copied to output folder closes: #21535 --- .../executors/build/lib/create-next-config-file.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/next/src/executors/build/lib/create-next-config-file.ts b/packages/next/src/executors/build/lib/create-next-config-file.ts index 588d4103fd1b2..89b66c7d5d2bc 100644 --- a/packages/next/src/executors/build/lib/create-next-config-file.ts +++ b/packages/next/src/executors/build/lib/create-next-config-file.ts @@ -77,10 +77,13 @@ export function createNextConfigFile( ); for (const moduleFile of moduleFilesToCopy) { ensureDirSync(dirname(join(context.root, options.outputPath, moduleFile))); - copyFileSync( - join(context.root, projectRoot, moduleFile), - join(context.root, options.outputPath, moduleFile) - ); + // We already generate a build version of package.json in the dist folder. + if (moduleFile !== 'package.json') { + copyFileSync( + join(context.root, projectRoot, moduleFile), + join(context.root, options.outputPath, moduleFile) + ); + } } }