@nx/module-federation 21.5.0-beta.0 → 21.5.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/package.json +10 -10
  2. package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.d.ts.map +1 -1
  3. package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.js +0 -1
  4. package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.d.ts.map +1 -1
  5. package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.js +0 -1
  6. package/src/plugins/utils/get-remotes.d.ts.map +1 -1
  7. package/src/plugins/utils/get-remotes.js +10 -5
  8. package/src/utils/get-remotes-for-host.d.ts.map +1 -1
  9. package/src/utils/get-remotes-for-host.js +9 -5
  10. package/src/with-module-federation/angular/utils.d.ts +1 -1
  11. package/src/with-module-federation/angular/utils.d.ts.map +1 -1
  12. package/src/with-module-federation/angular/utils.js +2 -2
  13. package/src/with-module-federation/angular/with-module-federation-ssr.d.ts.map +1 -1
  14. package/src/with-module-federation/angular/with-module-federation-ssr.js +1 -2
  15. package/src/with-module-federation/angular/with-module-federation.d.ts.map +1 -1
  16. package/src/with-module-federation/angular/with-module-federation.js +5 -2
  17. package/src/with-module-federation/rspack/with-module-federation-ssr.d.ts.map +1 -1
  18. package/src/with-module-federation/rspack/with-module-federation-ssr.js +0 -1
  19. package/src/with-module-federation/rspack/with-module-federation.d.ts.map +1 -1
  20. package/src/with-module-federation/rspack/with-module-federation.js +0 -1
  21. package/src/with-module-federation/webpack/utils.d.ts +1 -1
  22. package/src/with-module-federation/webpack/utils.d.ts.map +1 -1
  23. package/src/with-module-federation/webpack/utils.js +2 -2
  24. package/src/with-module-federation/webpack/with-module-federation-ssr.d.ts.map +1 -1
  25. package/src/with-module-federation/webpack/with-module-federation-ssr.js +1 -2
  26. package/src/with-module-federation/webpack/with-module-federation.d.ts.map +1 -1
  27. package/src/with-module-federation/webpack/with-module-federation.js +1 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/module-federation",
3
3
  "description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
4
- "version": "21.5.0-beta.0",
4
+ "version": "21.5.0-beta.2",
5
5
  "type": "commonjs",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,21 +24,21 @@
24
24
  "main": "index.js",
25
25
  "executors": "./executors.json",
26
26
  "dependencies": {
27
- "tslib": "^2.3.0",
28
- "@nx/devkit": "21.5.0-beta.0",
29
- "@nx/js": "21.5.0-beta.0",
30
- "@nx/web": "21.5.0-beta.0",
31
- "picocolors": "^1.1.0",
32
- "webpack": "^5.88.0",
33
- "@rspack/core": "^1.3.8",
34
27
  "@module-federation/enhanced": "^0.18.0",
35
28
  "@module-federation/node": "^2.7.11",
36
29
  "@module-federation/sdk": "^0.18.0",
30
+ "@nx/devkit": "21.5.0-beta.2",
31
+ "@nx/js": "21.5.0-beta.2",
32
+ "@nx/web": "21.5.0-beta.2",
33
+ "@rspack/core": "^1.3.8",
37
34
  "express": "^4.21.2",
38
- "http-proxy-middleware": "^3.0.5"
35
+ "http-proxy-middleware": "^3.0.5",
36
+ "picocolors": "^1.1.0",
37
+ "tslib": "^2.3.0",
38
+ "webpack": "^5.101.3"
39
39
  },
40
40
  "devDependencies": {
41
- "nx": "21.5.0-beta.0"
41
+ "nx": "21.5.0-beta.2"
42
42
  },
43
43
  "nx-migrations": {
44
44
  "migrations": "./migrations.json"
@@ -1 +1 @@
1
- {"version":3,"file":"nx-module-federation-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,uBAAuB,CAAC;AAI/B,qBAAa,wBAAyB,YAAW,oBAAoB;IAEjE,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,cAAc,CAAC;gBAJf,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,EACO,cAAc,CAAC,EAAE,gCAAgC;IAG3D,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA2EzB"}
1
+ {"version":3,"file":"nx-module-federation-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,uBAAuB,CAAC;AAI/B,qBAAa,wBAAyB,YAAW,oBAAoB;IAEjE,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,cAAc,CAAC;gBAJf,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,EACO,cAAc,CAAC,EAAE,gCAAgC;IAG3D,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA0EzB"}
@@ -66,7 +66,6 @@ class NxModuleFederationPlugin {
66
66
  : {}),
67
67
  ...(this.configOverride ? this.configOverride : {}),
68
68
  runtimePlugins,
69
- virtualRuntimeEntry: true,
70
69
  }).apply(compiler);
71
70
  if (sharedLibraries) {
72
71
  sharedLibraries.getReplacementPlugin().apply(compiler);
@@ -1 +1 @@
1
- {"version":3,"file":"nx-module-federation-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,uBAAuB,CAAC;AAI/B,qBAAa,wBAAyB,YAAW,oBAAoB;IAEjE,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,cAAc,CAAC;gBAJf,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,EACO,cAAc,CAAC,EAAE,gCAAgC;IAG3D,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAoEzB"}
1
+ {"version":3,"file":"nx-module-federation-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,uBAAuB,CAAC;AAI/B,qBAAa,wBAAyB,YAAW,oBAAoB;IAEjE,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,cAAc,CAAC;gBAJf,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,EACO,cAAc,CAAC,EAAE,gCAAgC;IAG3D,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAmEzB"}
@@ -63,7 +63,6 @@ class NxModuleFederationPlugin {
63
63
  : {}),
64
64
  ...(this.configOverride ? this.configOverride : {}),
65
65
  runtimePlugins,
66
- virtualRuntimeEntry: true,
67
66
  }).apply(compiler);
68
67
  if (sharedLibraries) {
69
68
  sharedLibraries.getReplacementPlugin().apply(compiler);
@@ -1 +1 @@
1
- {"version":3,"file":"get-remotes.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/plugins/utils/get-remotes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAiB,MAAM,YAAY,CAAC;AACjE,OAAO,EAA6B,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIhF,wBAAgB,UAAU,CACxB,MAAM,EAAE,sBAAsB,EAC9B,YAAY,EAAE,YAAY,EAC1B,kBAAkB,CAAC,EAAE,MAAM;;;;EAkC5B"}
1
+ {"version":3,"file":"get-remotes.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/plugins/utils/get-remotes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAiB,MAAM,YAAY,CAAC;AACjE,OAAO,EAA6B,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIhF,wBAAgB,UAAU,CACxB,MAAM,EAAE,sBAAsB,EAC9B,YAAY,EAAE,YAAY,EAC1B,kBAAkB,CAAC,EAAE,MAAM;;;;EAoC5B"}
@@ -19,6 +19,7 @@ function getRemotes(config, projectGraph, pathToManifestFile) {
19
19
  return r;
20
20
  });
21
21
  const knownDynamicRemotes = normalizedDynamicRemotes.filter((r) => projectGraph.nodes[r]);
22
+ knownDynamicRemotes.forEach((r) => collectRemoteProjects(r, collectedRemotes, projectGraph));
22
23
  const remotePorts = [...collectedRemotes, ...knownDynamicRemotes].map((r) => projectGraph.nodes[r].data.targets['serve'].options.port);
23
24
  const staticRemotePort = Math.max(...[...remotePorts]) + 1;
24
25
  return {
@@ -33,12 +34,16 @@ function extractRemoteProjectsFromConfig(config, pathToManifestFile) {
33
34
  if (pathToManifestFile && (0, fs_1.existsSync)(pathToManifestFile)) {
34
35
  const moduleFederationManifestJson = (0, fs_1.readFileSync)(pathToManifestFile, 'utf-8');
35
36
  if (moduleFederationManifestJson) {
36
- // This should have shape of
37
- // {
38
- // "remoteName": "remoteLocation",
39
- // }
37
+ /**
38
+ *
39
+ * This should have shape of
40
+ * {
41
+ * "remoteName": "remoteLocation",
42
+ * }
43
+ * But users might have their own, enforce only that the key is the remote name
44
+ */
40
45
  const parsedManifest = JSON.parse(moduleFederationManifestJson);
41
- if (Object.keys(parsedManifest).every((key) => typeof key === 'string' && typeof parsedManifest[key] === 'string')) {
46
+ if (Object.keys(parsedManifest).every((key) => typeof key === 'string')) {
42
47
  dynamicRemotes.push(...Object.keys(parsedManifest));
43
48
  }
44
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-remotes-for-host.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/get-remotes-for-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,UAAU,+BAA+B;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAqCD,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,YAAY,UA0B3B;AAoCD,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,+BAA+B,EACxC,kBAAkB,CAAC,EAAE,MAAM;;;;;;EAkF5B;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,OAAO,GAAG,SAAmB,OAkD1C"}
1
+ {"version":3,"file":"get-remotes-for-host.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/get-remotes-for-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,UAAU,+BAA+B;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAoCD,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,YAAY,UA0B3B;AAoCD,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,+BAA+B,EACxC,kBAAkB,CAAC,EAAE,MAAM;;;;;;EAkF5B;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,OAAO,GAAG,SAAmB,OAkD1C"}
@@ -15,12 +15,16 @@ function extractRemoteProjectsFromConfig(config, pathToManifestFile) {
15
15
  if (pathToManifestFile && (0, fs_1.existsSync)(pathToManifestFile)) {
16
16
  const moduleFederationManifestJson = (0, fs_1.readFileSync)(pathToManifestFile, 'utf-8');
17
17
  if (moduleFederationManifestJson) {
18
- // This should have shape of
19
- // {
20
- // "remoteName": "remoteLocation",
21
- // }
18
+ /**
19
+ *
20
+ * This should have shape of
21
+ * {
22
+ * "remoteName": "remoteLocation",
23
+ * }
24
+ * But users might have their own, enforce only that the key is the remote name
25
+ */
22
26
  const parsedManifest = JSON.parse(moduleFederationManifestJson);
23
- if (Object.keys(parsedManifest).every((key) => typeof key === 'string' && typeof parsedManifest[key] === 'string')) {
27
+ if (Object.keys(parsedManifest).every((key) => typeof key === 'string')) {
24
28
  dynamicRemotes.push(...Object.keys(parsedManifest));
25
29
  }
26
30
  }
@@ -6,7 +6,7 @@ export declare function getFunctionDeterminateRemoteUrl(isServer?: boolean, useR
6
6
  export declare function getModuleFederationConfig(mfConfig: ModuleFederationConfig, options?: {
7
7
  isServer: boolean;
8
8
  determineRemoteUrl?: (remote: string) => string;
9
- }): Promise<{
9
+ }, bundler?: 'rspack' | 'webpack'): Promise<{
10
10
  sharedLibraries: import("../../utils").SharedWorkspaceLibraryConfig;
11
11
  sharedDependencies: {
12
12
  [x: string]: SharedLibraryConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/angular/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,sBAAsB,EACtB,mBAAmB,EAGpB,MAAM,aAAa,CAAC;AASrB,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,SAAS,UAAQ,QAwBlB;AAED,eAAO,MAAM,6BAA6B,UAKzC,CAAC;AACF,eAAO,MAAM,iCAAiC,UAI7C,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,QAAQ,GAAE,OAAe,EACzB,SAAS,UAAQ,IASA,QAAQ,MAAM,YAkChC;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE;IACP,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3B;;;;;;GA0ExB;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE;IACP,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3B,EACvB,SAAS,UAAQ;;;;;;EAwElB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/angular/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,sBAAsB,EACtB,mBAAmB,EAGpB,MAAM,aAAa,CAAC;AASrB,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,SAAS,UAAQ,QAwBlB;AAED,eAAO,MAAM,6BAA6B,UAKzC,CAAC;AACF,eAAO,MAAM,iCAAiC,UAI7C,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,QAAQ,GAAE,OAAe,EACzB,SAAS,UAAQ,IASA,QAAQ,MAAM,YAkChC;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE;IACP,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3B,EACvB,OAAO,GAAE,QAAQ,GAAG,SAAoB;;;;;;GA4EzC;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE;IACP,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3B,EACvB,SAAS,UAAQ;;;;;;EAwElB"}
@@ -75,7 +75,7 @@ function getFunctionDeterminateRemoteUrl(isServer = false, useRspack = false) {
75
75
  return `${useRspack ? `${remote}@` : ''}${host.endsWith('/') ? host.slice(0, -1) : host}:${port}/${remoteEntry}`;
76
76
  };
77
77
  }
78
- async function getModuleFederationConfig(mfConfig, options = { isServer: false }) {
78
+ async function getModuleFederationConfig(mfConfig, options = { isServer: false }, bundler = 'rspack') {
79
79
  let projectGraph;
80
80
  try {
81
81
  projectGraph = (0, devkit_1.readCachedProjectGraph)();
@@ -91,7 +91,7 @@ async function getModuleFederationConfig(mfConfig, options = { isServer: false }
91
91
  dependencies.workspaceLibraries = dependencies.workspaceLibraries.filter((lib) => mfConfig.shared(lib.importKey, {}) !== false);
92
92
  dependencies.npmPackages = dependencies.npmPackages.filter((pkg) => mfConfig.shared(pkg, {}) !== false);
93
93
  }
94
- const sharedLibraries = (0, utils_1.shareWorkspaceLibraries)(dependencies.workspaceLibraries);
94
+ const sharedLibraries = (0, utils_1.shareWorkspaceLibraries)(dependencies.workspaceLibraries, undefined, bundler);
95
95
  const npmPackages = (0, utils_1.sharePackages)(Array.from(new Set([
96
96
  ...exports.DEFAULT_ANGULAR_PACKAGES_TO_SHARE,
97
97
  ...dependencies.npmPackages.filter((pkg) => !exports.DEFAULT_NPM_PACKAGES_TO_AVOID.includes(pkg)),
@@ -1 +1 @@
1
- {"version":3,"file":"with-module-federation-ssr.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/angular/with-module-federation-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACtC,MAAM,aAAa,CAAC;AAGrB,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,iCAyFlD"}
1
+ {"version":3,"file":"with-module-federation-ssr.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/angular/with-module-federation-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACtC,MAAM,aAAa,CAAC;AAGrB,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,iCA4FlD"}
@@ -10,7 +10,7 @@ async function withModuleFederationForSSR(options, configOverride) {
10
10
  const isDevServer = process.env['WEBPACK_SERVE'];
11
11
  const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options, {
12
12
  isServer: true,
13
- });
13
+ }, 'webpack');
14
14
  return (config) => {
15
15
  const updatedConfig = {
16
16
  ...(config ?? {}),
@@ -66,7 +66,6 @@ async function withModuleFederationForSSR(options, configOverride) {
66
66
  ...(configOverride?.runtimePlugins ?? []),
67
67
  require.resolve('@module-federation/node/runtimePlugin'),
68
68
  ],
69
- virtualRuntimeEntry: true,
70
69
  }, {}),
71
70
  sharedLibraries.getReplacementPlugin(),
72
71
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"with-module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/angular/with-module-federation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACtC,MAAM,aAAa,CAAC;AAIrB,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,iCA+ElD"}
1
+ {"version":3,"file":"with-module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/angular/with-module-federation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACtC,MAAM,aAAa,CAAC;AAIrB,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,iCAkFlD"}
@@ -8,8 +8,12 @@ async function withModuleFederation(options, configOverride) {
8
8
  if (global.NX_GRAPH_CREATION) {
9
9
  return (config) => config;
10
10
  }
11
+ // This is required to ensure that the webpack version used by the Angular CLI is used
12
+ process.env['FEDERATION_WEBPACK_PATH'] = require.resolve('webpack', {
13
+ paths: [require.resolve('@angular-devkit/build-angular')],
14
+ });
11
15
  const isDevServer = process.env['WEBPACK_SERVE'];
12
- const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options);
16
+ const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options, undefined, 'webpack');
13
17
  return (config) => {
14
18
  const updatedConfig = {
15
19
  ...(config ?? {}),
@@ -59,7 +63,6 @@ async function withModuleFederation(options, configOverride) {
59
63
  require.resolve('@nx/module-federation/src/utils/plugins/runtime-library-control.plugin.js'),
60
64
  ]
61
65
  : configOverride?.runtimePlugins,
62
- virtualRuntimeEntry: true,
63
66
  }),
64
67
  sharedLibraries.getReplacementPlugin(),
65
68
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"with-module-federation-ssr.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/rspack/with-module-federation-ssr.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAGrB,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC;;WAiFlD"}
1
+ {"version":3,"file":"with-module-federation-ssr.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/rspack/with-module-federation-ssr.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAGrB,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC;;WAgFlD"}
@@ -59,7 +59,6 @@ async function withModuleFederationForSSR(options, configOverride) {
59
59
  ...(configOverride?.runtimePlugins ?? []),
60
60
  require.resolve('@module-federation/node/runtimePlugin'),
61
61
  ],
62
- virtualRuntimeEntry: true,
63
62
  }, {}), sharedLibraries.getReplacementPlugin());
64
63
  // The env var is only set from the module-federation-dev-server
65
64
  // Attach the runtime plugin
@@ -1 +1 @@
1
- {"version":3,"file":"with-module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/rspack/with-module-federation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAMrB;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,oBAcvC,aAAa;;MAEpB,aAAa,EAqEjB"}
1
+ {"version":3,"file":"with-module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/rspack/with-module-federation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAMrB;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,oBAcvC,aAAa;;MAEpB,aAAa,EAoEjB"}
@@ -62,7 +62,6 @@ async function withModuleFederation(options, configOverride) {
62
62
  require.resolve('@nx/module-federation/src/utils/plugins/runtime-library-control.plugin.js'),
63
63
  ]
64
64
  : configOverride?.runtimePlugins,
65
- virtualRuntimeEntry: true,
66
65
  }), sharedLibraries.getReplacementPlugin());
67
66
  // The env var is only set from the module-federation-dev-server
68
67
  // Attach the runtime plugin
@@ -3,7 +3,7 @@ export declare function getFunctionDeterminateRemoteUrl(isServer?: boolean): (re
3
3
  export declare function getModuleFederationConfig(mfConfig: ModuleFederationConfig, options?: {
4
4
  isServer: boolean;
5
5
  determineRemoteUrl?: (remote: string) => string;
6
- }): Promise<{
6
+ }, bundler?: 'rspack' | 'webpack'): Promise<{
7
7
  sharedLibraries: import("../../utils").SharedWorkspaceLibraryConfig;
8
8
  sharedDependencies: {
9
9
  [x: string]: import("../../utils").SharedLibraryConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/webpack/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAWrB,wBAAgB,+BAA+B,CAAC,QAAQ,GAAE,OAAe,IAItD,QAAQ,MAAM,YAkChC;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE;IACP,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3B;;;;;;GA4ExB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/webpack/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAWrB,wBAAgB,+BAA+B,CAAC,QAAQ,GAAE,OAAe,IAItD,QAAQ,MAAM,YAkChC;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE;IACP,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3B,EACvB,OAAO,GAAE,QAAQ,GAAG,SAAoB;;;;;;GA8EzC"}
@@ -36,7 +36,7 @@ function getFunctionDeterminateRemoteUrl(isServer = false) {
36
36
  return `${host.endsWith('/') ? host.slice(0, -1) : host}:${port}/${remoteEntry}`;
37
37
  };
38
38
  }
39
- async function getModuleFederationConfig(mfConfig, options = { isServer: false }) {
39
+ async function getModuleFederationConfig(mfConfig, options = { isServer: false }, bundler = 'rspack') {
40
40
  let projectGraph;
41
41
  try {
42
42
  projectGraph = (0, devkit_1.readCachedProjectGraph)();
@@ -53,7 +53,7 @@ async function getModuleFederationConfig(mfConfig, options = { isServer: false }
53
53
  dependencies.workspaceLibraries = dependencies.workspaceLibraries.filter((lib) => mfConfig.shared(lib.importKey, {}) !== false);
54
54
  dependencies.npmPackages = dependencies.npmPackages.filter((pkg) => mfConfig.shared(pkg, {}) !== false);
55
55
  }
56
- const sharedLibraries = (0, utils_1.shareWorkspaceLibraries)(dependencies.workspaceLibraries);
56
+ const sharedLibraries = (0, utils_1.shareWorkspaceLibraries)(dependencies.workspaceLibraries, undefined, bundler);
57
57
  const npmPackages = (0, utils_1.sharePackages)(dependencies.npmPackages);
58
58
  const sharedDependencies = {
59
59
  ...sharedLibraries.getLibraries(project.root),
@@ -1 +1 @@
1
- {"version":3,"file":"with-module-federation-ssr.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/webpack/with-module-federation-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAIrB,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,iCA2ElD"}
1
+ {"version":3,"file":"with-module-federation-ssr.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/webpack/with-module-federation-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAIrB,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,iCA8ElD"}
@@ -10,7 +10,7 @@ async function withModuleFederationForSSR(options, configOverride) {
10
10
  const isDevServer = process.env['WEBPACK_SERVE'];
11
11
  const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options, {
12
12
  isServer: true,
13
- });
13
+ }, 'webpack');
14
14
  return (config) => {
15
15
  config.target = 'async-node';
16
16
  config.output.uniqueName = options.name;
@@ -51,7 +51,6 @@ async function withModuleFederationForSSR(options, configOverride) {
51
51
  ...(configOverride?.runtimePlugins ?? []),
52
52
  require.resolve('@module-federation/node/runtimePlugin'),
53
53
  ],
54
- virtualRuntimeEntry: true,
55
54
  }, {}), sharedLibraries.getReplacementPlugin());
56
55
  // The env var is only set from the module-federation-dev-server
57
56
  // Attach the runtime plugin
@@ -1 +1 @@
1
- {"version":3,"file":"with-module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/webpack/with-module-federation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAKrB;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,2CA4ElD"}
1
+ {"version":3,"file":"with-module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/with-module-federation/webpack/with-module-federation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAKrB;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,gCAAgC,2CA2ElD"}
@@ -12,7 +12,7 @@ async function withModuleFederation(options, configOverride) {
12
12
  return (config) => config;
13
13
  }
14
14
  const isDevServer = process.env['WEBPACK_SERVE'];
15
- const { sharedDependencies, sharedLibraries, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options);
15
+ const { sharedDependencies, sharedLibraries, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options, undefined, 'webpack');
16
16
  return (config, ctx) => {
17
17
  config.output.uniqueName = options.name;
18
18
  config.output.publicPath = 'auto';
@@ -54,7 +54,6 @@ async function withModuleFederation(options, configOverride) {
54
54
  require.resolve('@nx/module-federation/src/utils/plugins/runtime-library-control.plugin.js'),
55
55
  ]
56
56
  : configOverride?.runtimePlugins,
57
- virtualRuntimeEntry: true,
58
57
  }), sharedLibraries.getReplacementPlugin());
59
58
  // The env var is only set from the module-federation-dev-server
60
59
  // Attach the runtime plugin