fix(nextjs): fix build for yarn pnp (#18387)
This commit is contained in:
parent
fd6bccddff
commit
cd6c8d373a
@ -1,8 +1,11 @@
|
|||||||
import 'dotenv/config';
|
import 'dotenv/config';
|
||||||
import {
|
import {
|
||||||
|
detectPackageManager,
|
||||||
ExecutorContext,
|
ExecutorContext,
|
||||||
|
getPackageManagerVersion,
|
||||||
logger,
|
logger,
|
||||||
readJsonFile,
|
readJsonFile,
|
||||||
|
workspaceRoot,
|
||||||
writeJsonFile,
|
writeJsonFile,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createLockFile, createPackageJson, getLockFileName } from '@nx/js';
|
import { createLockFile, createPackageJson, getLockFileName } from '@nx/js';
|
||||||
@ -53,7 +56,14 @@ export default async function buildExecutor(
|
|||||||
process.env.NX_NEXT_OUTPUT_PATH ??= outputPath;
|
process.env.NX_NEXT_OUTPUT_PATH ??= outputPath;
|
||||||
|
|
||||||
const args = createCliOptions({ experimentalAppOnly, profile, debug });
|
const args = createCliOptions({ experimentalAppOnly, profile, debug });
|
||||||
const command = `npx next build ${args.join(' ')}`;
|
const isYarnBerry =
|
||||||
|
detectPackageManager() === 'yarn' &&
|
||||||
|
gte(getPackageManagerVersion('yarn', workspaceRoot), '2.0.0');
|
||||||
|
const buildCommand = isYarnBerry
|
||||||
|
? `yarn next build ${projectRoot}`
|
||||||
|
: 'npx next build';
|
||||||
|
|
||||||
|
const command = `${buildCommand} ${args.join(' ')}`;
|
||||||
const execSyncOptions: ExecSyncOptions = {
|
const execSyncOptions: ExecSyncOptions = {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user