diff --git a/docs/generated/packages/next/executors/build.json b/docs/generated/packages/next/executors/build.json index 81911e84a576b..e0da0b4907177 100644 --- a/docs/generated/packages/next/executors/build.json +++ b/docs/generated/packages/next/executors/build.json @@ -72,6 +72,11 @@ "experimentalAppOnly": { "type": "boolean", "description": "Only build 'app' routes" + }, + "experimentalBuildMode": { + "type": "string", + "description": "Change the build mode.", + "enum": ["compile", "generate"] } }, "required": ["outputPath"], diff --git a/packages/next/src/executors/build/build.impl.ts b/packages/next/src/executors/build/build.impl.ts index 0def4add15f78..441a2490c7838 100644 --- a/packages/next/src/executors/build/build.impl.ts +++ b/packages/next/src/executors/build/build.impl.ts @@ -124,13 +124,24 @@ function runCliBuild( projectRoot: string, options: NextBuildBuilderOptions ) { - const { experimentalAppOnly, profile, debug, outputPath } = options; + const { + experimentalAppOnly, + experimentalBuildMode, + profile, + debug, + outputPath, + } = options; // Set output path here since it can also be set via CLI // We can retrieve it inside plugins/with-nx process.env.NX_NEXT_OUTPUT_PATH ??= outputPath; - const args = createCliOptions({ experimentalAppOnly, profile, debug }); + const args = createCliOptions({ + experimentalAppOnly, + experimentalBuildMode, + profile, + debug, + }); return new Promise((resolve, reject) => { childProcess = fork( require.resolve('next/dist/bin/next'), diff --git a/packages/next/src/executors/build/schema.json b/packages/next/src/executors/build/schema.json index 494aed17888ba..97cba15a0ffb6 100644 --- a/packages/next/src/executors/build/schema.json +++ b/packages/next/src/executors/build/schema.json @@ -69,6 +69,11 @@ "experimentalAppOnly": { "type": "boolean", "description": "Only build 'app' routes" + }, + "experimentalBuildMode": { + "type": "string", + "description": "Change the build mode.", + "enum": ["compile", "generate"] } }, "required": ["outputPath"], diff --git a/packages/next/src/utils/types.ts b/packages/next/src/utils/types.ts index 63696f6007cdb..b9e6a2bbc3bd8 100644 --- a/packages/next/src/utils/types.ts +++ b/packages/next/src/utils/types.ts @@ -39,6 +39,7 @@ export interface NextBuildBuilderOptions { debug?: boolean; profile?: boolean; experimentalAppOnly?: boolean; + experimentalBuildMode?: 'compile' | 'generate'; } export interface NextServeBuilderOptions {