Files
Jack Hsu 820a3a6aaa fix(react): make module federation packages optional peer dependencies (#36492)
## Current Behavior

Installing `@nx/react` pulls `@nx/module-federation`, `express`,
`http-proxy-middleware`, `@svgr/webpack` and `@nx/rollup` as direct
dependencies. Installing `@nx/next` pulls `@nx/webpack` and
`@svgr/webpack`. Workspaces on esbuild, Vite or Rspack never run any of
it. `@nx/module-federation` also pins `webpack` exactly while
`@nx/webpack` installs a floating range, so workspaces end up with two
webpack copies and Module Federation builds fail.

## Expected Behavior

Module Federation packages become optional peers loaded lazily behind an
`assertPackageIsInstalled` guard; `@svgr/webpack` is removed outright
(SVGR support was removed in v23 and the v22 migrations inlined it to
userland); `@nx/module-federation` declares `webpack` as an optional
peer so it shares the app's copy. `23.2.0` migrations backfill the
Module Federation packages for workspaces that need them, and
`@svgr/webpack` for workspaces whose webpack or next configs reference
it (the v22 migrations inlined the `require.resolve` without declaring
the package). Same shape as #36310 for `@nx/angular`.

## Related Issue(s)

NXC-4688
2026-07-30 12:22:19 -04:00

23 lines
905 B
TypeScript

// Semi-private surface for first-party Nx packages.
//
// External plugins should NOT import from here — this entry is curated for
// internal consumers and may change without semver protection. Mirrors
// `@nx/devkit/internal`.
export { addE2e } from './src/generators/application/lib/add-e2e';
export { addRollupBuildTarget } from './src/generators/library/lib/add-rollup-build-target';
export { assertPackageIsInstalled } from './src/utils/assert-package';
export { isComponent } from './src/utils/ct-utils';
export { suppressReactComposeHelperWarnings } from './src/utils/deprecation';
export { hasWebpackPlugin } from './src/utils/has-webpack-plugin';
export {
getReactDependenciesVersionsToInstall,
isReact18,
} from './src/utils/version-utils';
export {
testingLibraryDomVersion,
testingLibraryReactVersion,
babelCoreVersion,
babelPresetReactVersion,
} from './src/utils/versions';