Skip to content

Commit

Permalink
fix(core): fix performance regression from using projects for loading… (
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored Nov 22, 2023
1 parent b6ea9cd commit 3a9c8e8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/nx/src/utils/nx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,21 @@ export async function loadNxPlugins(
{ plugin: CreatePackageJsonProjectsNextToProjectJson },
];

// When loading plugins for `createNodes`, we don't know what projects exist yet.
projects ??= await retrieveProjectConfigurationsWithoutPluginInference(root);

plugins ??= [];

// When loading plugins for `createNodes`, we don't know what projects exist yet.
// Try resolving plugins
for (const plugin of plugins) {
try {
require.resolve(typeof plugin === 'string' ? plugin : plugin.plugin);
} catch {
// If a plugin cannot be resolved, we will need projects to resolve it
projects ??= await retrieveProjectConfigurationsWithoutPluginInference(
root
);
break;
}
}
for (const plugin of plugins) {
result.push(await loadNxPluginAsync(plugin, paths, projects, root));
}
Expand Down

0 comments on commit 3a9c8e8

Please sign in to comment.