fix(core): nx plugin cache should load new plugins (#15072)
This commit is contained in:
parent
1e6a4f8e65
commit
e575c49c3e
@ -47,7 +47,7 @@ export interface NxPlugin {
|
|||||||
// holding resolved nx plugin objects.
|
// holding resolved nx plugin objects.
|
||||||
// Allows loadNxPlugins to be called multiple times w/o
|
// Allows loadNxPlugins to be called multiple times w/o
|
||||||
// executing resolution mulitple times.
|
// executing resolution mulitple times.
|
||||||
let nxPluginCache: NxPlugin[] = null;
|
let nxPluginCache: Map<string, NxPlugin> = new Map();
|
||||||
|
|
||||||
function loadNxPlugin(moduleName: string, paths: string[], root: string) {
|
function loadNxPlugin(moduleName: string, paths: string[], root: string) {
|
||||||
let pluginPath: string;
|
let pluginPath: string;
|
||||||
@ -98,13 +98,16 @@ export function loadNxPlugins(
|
|||||||
result.push(jsPlugin as NxPlugin);
|
result.push(jsPlugin as NxPlugin);
|
||||||
|
|
||||||
plugins ??= [];
|
plugins ??= [];
|
||||||
if (!nxPluginCache) {
|
for (const plugin of plugins) {
|
||||||
nxPluginCache = plugins.map((moduleName) =>
|
let pluginModule = nxPluginCache.get(plugin);
|
||||||
loadNxPlugin(moduleName, paths, root)
|
if (!pluginModule) {
|
||||||
);
|
pluginModule = loadNxPlugin(plugin, paths, root);
|
||||||
|
nxPluginCache.set(plugin, pluginModule);
|
||||||
|
}
|
||||||
|
result.push(pluginModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.concat(nxPluginCache);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mergePluginTargetsWithNxTargets(
|
export function mergePluginTargetsWithNxTargets(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user