diff --git a/packages/nx/src/config/workspaces.ts b/packages/nx/src/config/workspaces.ts index 470735abd2e89..989c52c9eb59d 100644 --- a/packages/nx/src/config/workspaces.ts +++ b/packages/nx/src/config/workspaces.ts @@ -1,6 +1,7 @@ import { dirname, join } from 'path'; import { workspaceRoot } from '../utils/workspace-root'; import { readJsonFile } from '../utils/fileutils'; +import { getNxRequirePaths } from '../utils/installation-directory'; import { loadNxPlugins, loadNxPluginsSync } from '../utils/nx-plugin'; import type { NxJsonConfiguration } from './nx-json'; @@ -43,7 +44,11 @@ export class Workspaces { buildProjectsConfigurationsFromProjectPathsAndPlugins( nxJson, projectPaths, - loadNxPluginsSync(), + loadNxPluginsSync( + nxJson.plugins, + getNxRequirePaths(this.root), + this.root + ), this.root ).projects; if ( @@ -59,10 +64,7 @@ export class Workspaces { } this.cachedProjectsConfig = { version: 2, - projects: this.mergeTargetDefaultsIntoProjectDescriptions( - projectsConfigurations, - nxJson - ), + projects: projectsConfigurations, }; return this.cachedProjectsConfig; } diff --git a/packages/nx/src/utils/nx-plugin.ts b/packages/nx/src/utils/nx-plugin.ts index b031f097830ba..3632249c14254 100644 --- a/packages/nx/src/utils/nx-plugin.ts +++ b/packages/nx/src/utils/nx-plugin.ts @@ -209,7 +209,7 @@ function loadNxPluginSync(moduleName: string, paths: string[], root: string) { * @deprecated Use loadNxPlugins instead. */ export function loadNxPluginsSync( - plugins?: string[], + plugins: string[], paths = getNxRequirePaths(), root = workspaceRoot ): (NxPluginV2 & Pick)[] { @@ -240,7 +240,7 @@ export function loadNxPluginsSync( } export async function loadNxPlugins( - plugins?: string[], + plugins: string[], paths = getNxRequirePaths(), root = workspaceRoot ): Promise<(NxPluginV2 & Pick)[]> {