Skip to content

Commit

Permalink
fix(core): correct log message when uninstalled plugin is referenced …
Browse files Browse the repository at this point in the history
…in nx.json (#9994)

Fixes #9976
  • Loading branch information
AgentEnder authored and FrozenPandaz committed Apr 28, 2022
1 parent c1950c1 commit 793bd76
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/nx/src/utils/nx-plugin.ts
Expand Up @@ -14,6 +14,7 @@ import {
WorkspaceJsonConfiguration,
} from '../config/workspace-json-project-json';
import { findMatchingProjectForPath } from './target-project-locator';
import { logger } from './logger';

export type ProjectTargetConfigurator = (
file: string
Expand Down Expand Up @@ -54,10 +55,19 @@ export function loadNxPlugins(
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
const plugin = resolveLocalNxPlugin(moduleName);
const main = readPluginMainFromProjectConfiguration(
plugin.projectConfig
);
pluginPath = main ? path.join(workspaceRoot, main) : plugin.path;
if (plugin) {
const main = readPluginMainFromProjectConfiguration(
plugin.projectConfig
);
pluginPath = main
? path.join(workspaceRoot, main)
: plugin.path;
} else {
logger.error(
`Plugin listed in \`nx.json\` not found: ${moduleName}`
);
throw e;
}
} else {
throw e;
}
Expand Down

0 comments on commit 793bd76

Please sign in to comment.