@nx/module-federation 22.0.0-beta.8 → 22.0.0-beta.9
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.
- package/package.json +5 -5
- package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.d.ts.map +1 -1
- package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.js +5 -6
- package/src/utils/dependencies.js +8 -6
- package/src/with-module-federation/angular/utils.d.ts.map +1 -1
- package/src/with-module-federation/angular/utils.js +4 -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": "22.0.0-beta.
|
|
4
|
+
"version": "22.0.0-beta.9",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@module-federation/enhanced": "^0.18.0",
|
|
28
28
|
"@module-federation/node": "^2.7.11",
|
|
29
29
|
"@module-federation/sdk": "^0.18.0",
|
|
30
|
-
"@nx/devkit": "22.0.0-beta.
|
|
31
|
-
"@nx/js": "22.0.0-beta.
|
|
32
|
-
"@nx/web": "22.0.0-beta.
|
|
30
|
+
"@nx/devkit": "22.0.0-beta.9",
|
|
31
|
+
"@nx/js": "22.0.0-beta.9",
|
|
32
|
+
"@nx/web": "22.0.0-beta.9",
|
|
33
33
|
"@rspack/core": "^1.3.8",
|
|
34
34
|
"express": "^4.21.2",
|
|
35
35
|
"http-proxy-middleware": "^3.0.5",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"webpack": "^5.101.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"nx": "22.0.0-beta.
|
|
41
|
+
"nx": "22.0.0-beta.9"
|
|
42
42
|
},
|
|
43
43
|
"nx-migrations": {
|
|
44
44
|
"migrations": "./migrations.json"
|
package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.d.ts.map
CHANGED
|
@@ -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;
|
|
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;CA4EzB"}
|
|
@@ -14,7 +14,10 @@ class NxModuleFederationPlugin {
|
|
|
14
14
|
}
|
|
15
15
|
// This is required to ensure Module Federation will build the project correctly
|
|
16
16
|
compiler.options.optimization ??= {};
|
|
17
|
-
compiler.options.optimization.runtimeChunk =
|
|
17
|
+
compiler.options.optimization.runtimeChunk =
|
|
18
|
+
process.env['WEBPACK_SERVE'] && !this._options.config.exposes
|
|
19
|
+
? compiler.options.optimization?.runtimeChunk ?? undefined
|
|
20
|
+
: false;
|
|
18
21
|
if (compiler.options.optimization.splitChunks) {
|
|
19
22
|
compiler.options.optimization.splitChunks.cacheGroups ??= {};
|
|
20
23
|
compiler.options.optimization.splitChunks.cacheGroups.default = false;
|
|
@@ -24,10 +27,6 @@ class NxModuleFederationPlugin {
|
|
|
24
27
|
? 'auto'
|
|
25
28
|
: compiler.options.output.publicPath;
|
|
26
29
|
compiler.options.output.uniqueName = this._options.config.name;
|
|
27
|
-
if (compiler.options.output.scriptType === 'module') {
|
|
28
|
-
compiler.options.output.scriptType = undefined;
|
|
29
|
-
compiler.options.output.module = undefined;
|
|
30
|
-
}
|
|
31
30
|
if (this._options.isServer) {
|
|
32
31
|
compiler.options.target = 'async-node';
|
|
33
32
|
compiler.options.output.library ??= {
|
|
@@ -63,7 +62,7 @@ class NxModuleFederationPlugin {
|
|
|
63
62
|
},
|
|
64
63
|
remoteType: 'script',
|
|
65
64
|
}
|
|
66
|
-
: {}),
|
|
65
|
+
: { library: { type: 'module' } }),
|
|
67
66
|
...(this.configOverride ? this.configOverride : {}),
|
|
68
67
|
runtimePlugins,
|
|
69
68
|
}).apply(compiler);
|
|
@@ -24,12 +24,14 @@ function collectDependencies(projectGraph, name, dependencies = {
|
|
|
24
24
|
dependencies.npmPackages.add(dependency.target.replace('npm:', ''));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
if (projectGraph.nodes[dependency.target]) {
|
|
28
|
+
dependencies.workspaceLibraries.set(dependency.target, {
|
|
29
|
+
name: dependency.target,
|
|
30
|
+
root: projectGraph.nodes[dependency.target].data.root,
|
|
31
|
+
importKey: getLibraryImportPath(dependency.target, projectGraph),
|
|
32
|
+
});
|
|
33
|
+
collectDependencies(projectGraph, dependency.target, dependencies, seen);
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
});
|
|
35
37
|
return dependencies;
|
|
@@ -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,
|
|
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,EAEtB,mBAAmB,EAGpB,MAAM,aAAa,CAAC;AASrB,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,SAAS,UAAQ,QAyBlB;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;;;;;;EA2ElB"}
|
|
@@ -16,6 +16,7 @@ function applyDefaultEagerPackages(sharedConfig, useRspack = false) {
|
|
|
16
16
|
? [
|
|
17
17
|
'@angular/core',
|
|
18
18
|
'@angular/core/primitives/signals',
|
|
19
|
+
'@angular/core/primitives/di',
|
|
19
20
|
'@angular/core/event-dispatch',
|
|
20
21
|
'@angular/core/rxjs-interop',
|
|
21
22
|
'@angular/common',
|
|
@@ -72,7 +73,7 @@ function getFunctionDeterminateRemoteUrl(isServer = false, useRspack = false) {
|
|
|
72
73
|
const host = serveTarget.options?.host ??
|
|
73
74
|
`http${serveTarget.options.ssl ? 's' : ''}://localhost`;
|
|
74
75
|
const port = serveTarget.options?.port ?? 4201;
|
|
75
|
-
return `${
|
|
76
|
+
return `${host.endsWith('/') ? host.slice(0, -1) : host}:${port}/${remoteEntry}`;
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
79
|
async function getModuleFederationConfig(mfConfig, options = { isServer: false }, bundler = 'rspack') {
|
|
@@ -126,8 +127,9 @@ function getModuleFederationConfigSync(mfConfig, options = { isServer: false },
|
|
|
126
127
|
dependencies.workspaceLibraries = dependencies.workspaceLibraries.filter((lib) => mfConfig.shared(lib.importKey, {}) !== false);
|
|
127
128
|
dependencies.npmPackages = dependencies.npmPackages.filter((pkg) => mfConfig.shared(pkg, {}) !== false);
|
|
128
129
|
}
|
|
129
|
-
const sharedLibraries = (0, utils_1.shareWorkspaceLibraries)(dependencies.workspaceLibraries);
|
|
130
|
+
const sharedLibraries = (0, utils_1.shareWorkspaceLibraries)(dependencies.workspaceLibraries, undefined, 'rspack');
|
|
130
131
|
const npmPackages = (0, utils_1.sharePackages)(Array.from(new Set([
|
|
132
|
+
...exports.DEFAULT_ANGULAR_PACKAGES_TO_SHARE,
|
|
131
133
|
...dependencies.npmPackages.filter((pkg) => !exports.DEFAULT_NPM_PACKAGES_TO_AVOID.includes(pkg)),
|
|
132
134
|
])));
|
|
133
135
|
exports.DEFAULT_NPM_PACKAGES_TO_AVOID.forEach((pkgName) => {
|