diff --git a/.changeset/gold-clocks-suffer.md b/.changeset/gold-clocks-suffer.md new file mode 100644 index 0000000000..18883989f3 --- /dev/null +++ b/.changeset/gold-clocks-suffer.md @@ -0,0 +1,5 @@ +--- +'@module-federation/modern-js': patch +--- + +fix(modern-js-plugin): require node plugin on demand diff --git a/packages/modernjs/src/cli/ssrPlugin.ts b/packages/modernjs/src/cli/ssrPlugin.ts index 396ae9d17a..0f90dc809f 100644 --- a/packages/modernjs/src/cli/ssrPlugin.ts +++ b/packages/modernjs/src/cli/ssrPlugin.ts @@ -2,11 +2,10 @@ import path from 'path'; import { fs } from '@modern-js/utils'; import type { CliPlugin, AppTools } from '@modern-js/app-tools'; import type { InternalModernPluginOptions } from '../types'; -import { ModuleFederationPlugin } from '@module-federation/enhanced'; +import { ModuleFederationPlugin } from '@module-federation/enhanced/webpack'; import { ModuleFederationPlugin as RspackModuleFederationPlugin } from '@module-federation/enhanced/rspack'; -import { UniverseEntryChunkTrackerPlugin } from '@module-federation/node'; +import UniverseEntryChunkTrackerPlugin from '@module-federation/node/universe-entry-chunk-tracker-plugin'; import { updateStatsAndManifest } from './manifest'; -import { MODERN_JS_SERVER_DIR, PLUGIN_IDENTIFIER } from '../constant'; import { isDev } from './constant'; export function setEnv() { diff --git a/packages/node/package.json b/packages/node/package.json index fc7028ac32..f6e0561178 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -18,6 +18,7 @@ }, "./src/plugins/RemotePublicPathPlugin.js": "./dist/src/plugins/RemotePublicPathPlugin.js", "./src/plugins/NodeFederationPlugin.js": "./dist/src/plugins/NodeFederationPlugin.js", + "./universe-entry-chunk-tracker-plugin": "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.js", "./src/": "./dist/src/" }, "typesVersions": { @@ -33,6 +34,9 @@ ], "record-dynamic-remote-entry-hash-plugin": [ "./dist/src/record-dynamic-remote-entry-hash-plugin.d.ts" + ], + "universe-entry-chunk-tracker-plugin": [ + "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.ts" ] } },