File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
packages/next/src/executors/build Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
import 'dotenv/config' ;
2
2
import {
3
+ detectPackageManager ,
3
4
ExecutorContext ,
5
+ getPackageManagerVersion ,
4
6
logger ,
5
7
readJsonFile ,
8
+ workspaceRoot ,
6
9
writeJsonFile ,
7
10
} from '@nx/devkit' ;
8
11
import { createLockFile , createPackageJson , getLockFileName } from '@nx/js' ;
@@ -53,7 +56,14 @@ export default async function buildExecutor(
53
56
process . env . NX_NEXT_OUTPUT_PATH ??= outputPath ;
54
57
55
58
const args = createCliOptions ( { experimentalAppOnly, profile, debug } ) ;
56
- const command = `npx next build ${ args . join ( ' ' ) } ` ;
59
+ const isYarnBerry =
60
+ detectPackageManager ( ) === 'yarn' &&
61
+ gte ( getPackageManagerVersion ( 'yarn' , workspaceRoot ) , '2.0.0' ) ;
62
+ const buildCommand = isYarnBerry
63
+ ? `yarn next build ${ projectRoot } `
64
+ : 'npx next build' ;
65
+
66
+ const command = `${ buildCommand } ${ args . join ( ' ' ) } ` ;
57
67
const execSyncOptions : ExecSyncOptions = {
58
68
stdio : 'inherit' ,
59
69
encoding : 'utf-8' ,
You can’t perform that action at this time.
0 commit comments