-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(module-federation): ensure @nx/module-federation package is insta…
…lled for users (#29416) ## Current Behavior The `@nx/module-federation` package is a direct dependency of some of the other packages in the Nx Plugin ecosystem. It should be resolved correctly by package managers such that it can be used when setting up MF projects. However, some users are facing issues with module resolutions where the package is not found as expected. ## Expected Behavior Install the package directly for the user to ensure module resolution works as expected. ## Related Issue(s) Fixes #29269
- Loading branch information
Showing
12 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/angular/src/migrations/update-20-3-0/ensure-nx-module-federation-package.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
type Tree, | ||
readProjectConfiguration, | ||
addDependenciesToPackageJson, | ||
} from '@nx/devkit'; | ||
import { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils'; | ||
import { nxVersion } from '../../utils/versions'; | ||
|
||
export default async function ensureMfPackage(tree: Tree) { | ||
const projects = new Set<string>(); | ||
|
||
forEachExecutorOptions( | ||
tree, | ||
'@nx/angular:module-federation-dev-server', | ||
(options, project, target) => { | ||
const projectConfig = readProjectConfiguration(tree, project); | ||
projects.add(projectConfig.root); | ||
} | ||
); | ||
|
||
if (projects.size !== 0) { | ||
addDependenciesToPackageJson( | ||
tree, | ||
{}, | ||
{ | ||
'@nx/module-federation': nxVersion, | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/react/src/migrations/update-20-3-0/ensure-nx-module-federation-package.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
type Tree, | ||
readProjectConfiguration, | ||
addDependenciesToPackageJson, | ||
} from '@nx/devkit'; | ||
import { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils'; | ||
import { nxVersion } from '../../utils/versions'; | ||
|
||
export default async function ensureMfPackage(tree: Tree) { | ||
const projects = new Set<string>(); | ||
|
||
forEachExecutorOptions( | ||
tree, | ||
'@nx/react:module-federation-dev-server', | ||
(options, project, target) => { | ||
const projectConfig = readProjectConfiguration(tree, project); | ||
projects.add(projectConfig.root); | ||
} | ||
); | ||
|
||
if (projects.size !== 0) { | ||
addDependenciesToPackageJson( | ||
tree, | ||
{}, | ||
{ | ||
'@nx/module-federation': nxVersion, | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/rspack/src/migrations/update-20-3-0/ensure-nx-module-federation-package.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
type Tree, | ||
readProjectConfiguration, | ||
addDependenciesToPackageJson, | ||
} from '@nx/devkit'; | ||
import { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils'; | ||
import { nxVersion } from '../../utils/versions'; | ||
|
||
export default async function ensureMfPackage(tree: Tree) { | ||
const projects = new Set<string>(); | ||
|
||
forEachExecutorOptions( | ||
tree, | ||
'@nx/rspack:module-federation-dev-server', | ||
(options, project, target) => { | ||
const projectConfig = readProjectConfiguration(tree, project); | ||
projects.add(projectConfig.root); | ||
} | ||
); | ||
|
||
if (projects.size !== 0) { | ||
addDependenciesToPackageJson( | ||
tree, | ||
{}, | ||
{ | ||
'@nx/module-federation': nxVersion, | ||
} | ||
); | ||
} | ||
} |