From 071511819d942cba89fb75602d4bcfcb633ec06e Mon Sep 17 00:00:00 2001 From: Ian Serpa Date: Sat, 4 Mar 2023 14:56:51 +0100 Subject: [PATCH] Do not break build when appDir is enabled but empty --- packages/next/src/build/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 76ba7f9f9b6e2..80dfbcca4d10c 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -3029,7 +3029,10 @@ export default async function build( ), { overwrite: true } ) - if (appDir) { + if ( + appDir && + (await fileExists(path.join(distDir, SERVER_DIRECTORY, 'app'))) + ) { await recursiveCopy( path.join(distDir, SERVER_DIRECTORY, 'app'), path.join(