fix(module-federation): migration does not handle external nodes and errors (#29075)
## Current Behavior The React + Angular migrations intended to update the path for the `ModuleFederationConfig` imports in webpack and rspack config files will fail on externalNodes in the project graph that have `@nx/webpack` or `@nx/rspack` listed as a dependency. ## Expected Behavior If the dependency is discovered in an `externalNode` we should skip that node, instead of continuing with the migration.
This commit is contained in:
parent
30d722bd98
commit
a5c5cbf326
@ -22,6 +22,13 @@ jest.mock('@nx/devkit', () => {
|
||||
type: 'static',
|
||||
},
|
||||
],
|
||||
'npm:@nx/playwright': [
|
||||
{
|
||||
source: 'npm:@nx/playwright',
|
||||
target: 'npm:@nx/webpack',
|
||||
type: 'static',
|
||||
},
|
||||
],
|
||||
},
|
||||
nodes: {
|
||||
shell: {
|
||||
@ -43,6 +50,17 @@ jest.mock('@nx/devkit', () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
externalNodes: {
|
||||
'npm:@nx/playwright': {
|
||||
type: 'npm',
|
||||
name: 'npm:@nx/playwright',
|
||||
data: {
|
||||
version: '20.2.0-beta.3',
|
||||
packageName: '@nx/playwright',
|
||||
hash: 'sha512-8rzIZ8ljVfWsOqmSUSRPo0lT19oAhTR2nAI25V3wbFwhlErQ7kpgKd45W36Tja1aka729cO3mAH5ACKSujU6wQ==',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
),
|
||||
};
|
||||
|
||||
@ -13,6 +13,9 @@ export default async function migrateMfImportsToNewPackage(tree: Tree) {
|
||||
|
||||
const graph = await createProjectGraphAsync();
|
||||
for (const [project, dependencies] of Object.entries(graph.dependencies)) {
|
||||
if (!graph.nodes[project]) {
|
||||
continue;
|
||||
}
|
||||
const usesNxWebpack = dependencies.some(
|
||||
(dep) => dep.target === 'npm:@nx/webpack'
|
||||
);
|
||||
|
||||
@ -27,6 +27,13 @@ jest.mock('@nx/devkit', () => {
|
||||
type: 'static',
|
||||
},
|
||||
],
|
||||
'npm:@nx/playwright': [
|
||||
{
|
||||
source: 'npm:@nx/playwright',
|
||||
target: 'npm:@nx/webpack',
|
||||
type: 'static',
|
||||
},
|
||||
],
|
||||
},
|
||||
nodes: {
|
||||
shell: {
|
||||
@ -48,6 +55,17 @@ jest.mock('@nx/devkit', () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
externalNodes: {
|
||||
'npm:@nx/playwright': {
|
||||
type: 'npm',
|
||||
name: 'npm:@nx/playwright',
|
||||
data: {
|
||||
version: '20.2.0-beta.3',
|
||||
packageName: '@nx/playwright',
|
||||
hash: 'sha512-8rzIZ8ljVfWsOqmSUSRPo0lT19oAhTR2nAI25V3wbFwhlErQ7kpgKd45W36Tja1aka729cO3mAH5ACKSujU6wQ==',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
),
|
||||
};
|
||||
|
||||
@ -14,6 +14,9 @@ export default async function migrateMfImportsToNewPackage(tree: Tree) {
|
||||
|
||||
const graph = await createProjectGraphAsync();
|
||||
for (const [project, dependencies] of Object.entries(graph.dependencies)) {
|
||||
if (!graph.nodes[project]) {
|
||||
continue;
|
||||
}
|
||||
const usesNxWebpackOrRspack = dependencies.some(
|
||||
(dep) =>
|
||||
dep.target === 'npm:@nx/webpack' || dep.target === 'npm:@nx/rspack'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user