fix(nextjs): avoid path error on dev server creation (#21998)

This commit is contained in:
Javier Abia 2024-03-04 18:56:44 +01:00 committed by GitHub
parent 8ccdd73c8b
commit 1961bb514e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,8 @@ export default async function* serveExecutor(
);
const projectRoot = context.workspace.projects[context.projectName].root;
// This is required for the default custom server to work. See the @nx/next:app generator.
const nextDir = resolve(context.root, buildOptions.outputPath);
const nextDir =
!options.dev && resolve(context.root, buildOptions.outputPath);
process.env.NX_NEXT_DIR ??= options.dev ? projectRoot : nextDir;
if (options.customServerTarget) {