From f43ac5b633d6c24b6146e6b2bce5ad1837c9b39c Mon Sep 17 00:00:00 2001 From: Nicholas Cunningham Date: Fri, 21 Apr 2023 12:13:20 -0600 Subject: [PATCH] fix(nextjs): output path for standalone apps (#16465) --- .../next/src/generators/application/lib/add-project.ts | 7 ++++++- .../generators/application/lib/create-application-files.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/next/src/generators/application/lib/add-project.ts b/packages/next/src/generators/application/lib/add-project.ts index f94d4109ed4e8..14a1cf1c0a7ec 100644 --- a/packages/next/src/generators/application/lib/add-project.ts +++ b/packages/next/src/generators/application/lib/add-project.ts @@ -9,13 +9,18 @@ import { export function addProject(host: Tree, options: NormalizedSchema) { const targets: Record = {}; + const outputPath = joinPathFragments( + 'dist', + options.appProjectRoot, + ...(options.rootProject ? [options.name] : []) + ); targets.build = { executor: '@nx/next:build', outputs: ['{options.outputPath}'], defaultConfiguration: 'production', options: { root: options.appProjectRoot, - outputPath: joinPathFragments('dist', options.appProjectRoot), + outputPath: outputPath, }, configurations: { development: { diff --git a/packages/next/src/generators/application/lib/create-application-files.ts b/packages/next/src/generators/application/lib/create-application-files.ts index 8829ff25fdf5a..d70728da10ce5 100644 --- a/packages/next/src/generators/application/lib/create-application-files.ts +++ b/packages/next/src/generators/application/lib/create-application-files.ts @@ -80,6 +80,7 @@ export function createApplicationFiles(host: Tree, options: NormalizedSchema) { ...(updatedJson.exclude || []), ...(appJSON.exclude || []), '**e2e/**/*', + `dist/${options.name}/**/*`, ]), ], };