Skip to content

Commit b0506c9

Browse files
ndcunninghamFrozenPandaz
authored andcommitted
fix(nextjs): src package.json should not be copied to output folder
closes: #21535 (cherry picked from commit aa622ba)
1 parent 5b3af21 commit b0506c9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/next/src/executors/build/lib/create-next-config-file.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ export function createNextConfigFile(
7777
);
7878
for (const moduleFile of moduleFilesToCopy) {
7979
ensureDirSync(dirname(join(context.root, options.outputPath, moduleFile)));
80-
copyFileSync(
81-
join(context.root, projectRoot, moduleFile),
82-
join(context.root, options.outputPath, moduleFile)
83-
);
80+
// We already generate a build version of package.json in the dist folder.
81+
if (moduleFile !== 'package.json') {
82+
copyFileSync(
83+
join(context.root, projectRoot, moduleFile),
84+
join(context.root, options.outputPath, moduleFile)
85+
);
86+
}
8487
}
8588
}
8689

0 commit comments

Comments
 (0)