@nx/module-federation 21.3.10 → 21.3.12
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 +4 -4
- package/src/executors/utils/start-remote-iterators.js +2 -2
- package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.js +2 -1
- package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.js +2 -1
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.js +1 -0
- package/src/utils/normalize-project-name.d.ts +1 -0
- package/src/utils/normalize-project-name.js +10 -0
- package/src/utils/public-api.d.ts +2 -1
- package/src/utils/public-api.js +3 -1
- package/src/utils/remotes.js +8 -11
- package/src/with-module-federation/angular/with-module-federation-ssr.d.ts +1 -1
- package/src/with-module-federation/angular/with-module-federation-ssr.js +4 -3
- package/src/with-module-federation/angular/with-module-federation.d.ts +1 -1
- package/src/with-module-federation/angular/with-module-federation.js +4 -3
- package/src/with-module-federation/rspack/with-module-federation-ssr.js +4 -3
- package/src/with-module-federation/rspack/with-module-federation.js +4 -3
- package/src/with-module-federation/webpack/with-module-federation-ssr.js +4 -3
- package/src/with-module-federation/webpack/with-module-federation.js +4 -3
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.3.
|
|
4
|
+
"version": "21.3.12",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"executors": "./executors.json",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"tslib": "^2.3.0",
|
|
28
|
-
"@nx/devkit": "21.3.
|
|
29
|
-
"@nx/js": "21.3.
|
|
30
|
-
"@nx/web": "21.3.
|
|
28
|
+
"@nx/devkit": "21.3.12",
|
|
29
|
+
"@nx/js": "21.3.12",
|
|
30
|
+
"@nx/web": "21.3.12",
|
|
31
31
|
"picocolors": "^1.1.0",
|
|
32
32
|
"webpack": "^5.88.0",
|
|
33
33
|
"@rspack/core": "^1.3.8",
|
|
@@ -20,8 +20,8 @@ async function startRemoteIterators(options, context, startRemoteFn, pathToManif
|
|
|
20
20
|
options.staticRemotesPort ??= remotes.staticRemotePort;
|
|
21
21
|
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
22
22
|
process.env.NX_MF_DEV_REMOTES = JSON.stringify([
|
|
23
|
-
...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []).map((r) =>
|
|
24
|
-
|
|
23
|
+
...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []).map((r) => (0, utils_1.normalizeProjectName)(r)),
|
|
24
|
+
(0, utils_1.normalizeProjectName)(project.name),
|
|
25
25
|
]);
|
|
26
26
|
const staticRemotesConfig = isServer
|
|
27
27
|
? (0, utils_1.parseStaticSsrRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NxModuleFederationPlugin = void 0;
|
|
4
4
|
const utils_1 = require("../../../with-module-federation/angular/utils");
|
|
5
|
+
const utils_2 = require("../../../utils");
|
|
5
6
|
class NxModuleFederationPlugin {
|
|
6
7
|
constructor(_options, configOverride) {
|
|
7
8
|
this._options = _options;
|
|
@@ -43,7 +44,7 @@ class NxModuleFederationPlugin {
|
|
|
43
44
|
runtimePlugins.push(require.resolve('@module-federation/node/runtimePlugin'));
|
|
44
45
|
}
|
|
45
46
|
new (require('@module-federation/enhanced/rspack').ModuleFederationPlugin)({
|
|
46
|
-
name: this._options.config.name
|
|
47
|
+
name: (0, utils_2.normalizeProjectName)(this._options.config.name),
|
|
47
48
|
filename: 'remoteEntry.js',
|
|
48
49
|
exposes: this._options.config.exposes,
|
|
49
50
|
remotes: mappedRemotes,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NxModuleFederationPlugin = void 0;
|
|
4
4
|
const utils_1 = require("../../../with-module-federation/rspack/utils");
|
|
5
|
+
const utils_2 = require("../../../utils");
|
|
5
6
|
class NxModuleFederationPlugin {
|
|
6
7
|
constructor(_options, configOverride) {
|
|
7
8
|
this._options = _options;
|
|
@@ -40,7 +41,7 @@ class NxModuleFederationPlugin {
|
|
|
40
41
|
runtimePlugins.push(require.resolve('@module-federation/node/runtimePlugin'));
|
|
41
42
|
}
|
|
42
43
|
new (require('@module-federation/enhanced/rspack').ModuleFederationPlugin)({
|
|
43
|
-
name: this._options.config.name
|
|
44
|
+
name: (0, utils_2.normalizeProjectName)(this._options.config.name),
|
|
44
45
|
filename: 'remoteEntry.js',
|
|
45
46
|
exposes: this._options.config.exposes,
|
|
46
47
|
remotes: mappedRemotes,
|
package/src/utils/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './dependencies';
|
|
|
3
3
|
export * from './package-json';
|
|
4
4
|
export * from './remotes';
|
|
5
5
|
export * from './models';
|
|
6
|
+
export * from './normalize-project-name';
|
|
6
7
|
export * from './get-remotes-for-host';
|
|
7
8
|
export * from './parse-static-remotes-config';
|
|
8
9
|
export * from './start-remote-proxies';
|
package/src/utils/index.js
CHANGED
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./dependencies"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./package-json"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./remotes"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./models"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./normalize-project-name"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./get-remotes-for-host"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./parse-static-remotes-config"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./start-remote-proxies"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeProjectName(name: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeProjectName = normalizeProjectName;
|
|
4
|
+
// normalize to allow only JavaScript var valid names
|
|
5
|
+
function normalizeProjectName(name) {
|
|
6
|
+
// Replace invalid starting characters with '_'
|
|
7
|
+
const normalized = name.replace(/^[^a-zA-Z_$]/, '_');
|
|
8
|
+
// Replace invalid subsequent characters with '_'
|
|
9
|
+
return normalized.replace(/[^a-zA-Z0-9_$]/g, '_');
|
|
10
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AdditionalSharedConfig, ModuleFederationConfig, ModuleFederationLibrary, NxModuleFederationConfigOverride, Remotes, SharedFunction, SharedLibraryConfig, SharedWorkspaceLibraryConfig, WorkspaceLibrary, WorkspaceLibrarySecondaryEntryPoint } from './models';
|
|
2
2
|
import { applyAdditionalShared, applySharedFunction, getNpmPackageSharedConfig, sharePackages, shareWorkspaceLibraries } from './share';
|
|
3
|
+
import { normalizeProjectName } from './normalize-project-name';
|
|
3
4
|
import { mapRemotes, mapRemotesForSSR } from './remotes';
|
|
4
5
|
import { getDependentPackagesForProject } from './dependencies';
|
|
5
6
|
import { readRootPackageJson } from './package-json';
|
|
6
|
-
export { ModuleFederationConfig, NxModuleFederationConfigOverride, SharedLibraryConfig, SharedWorkspaceLibraryConfig, AdditionalSharedConfig, WorkspaceLibrary, SharedFunction, WorkspaceLibrarySecondaryEntryPoint, Remotes, ModuleFederationLibrary, applySharedFunction, applyAdditionalShared, getNpmPackageSharedConfig, shareWorkspaceLibraries, sharePackages, mapRemotes, mapRemotesForSSR, getDependentPackagesForProject, readRootPackageJson, };
|
|
7
|
+
export { ModuleFederationConfig, NxModuleFederationConfigOverride, SharedLibraryConfig, SharedWorkspaceLibraryConfig, AdditionalSharedConfig, WorkspaceLibrary, SharedFunction, WorkspaceLibrarySecondaryEntryPoint, Remotes, ModuleFederationLibrary, applySharedFunction, applyAdditionalShared, getNpmPackageSharedConfig, shareWorkspaceLibraries, sharePackages, mapRemotes, mapRemotesForSSR, normalizeProjectName, getDependentPackagesForProject, readRootPackageJson, };
|
package/src/utils/public-api.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readRootPackageJson = exports.getDependentPackagesForProject = exports.mapRemotesForSSR = exports.mapRemotes = exports.sharePackages = exports.shareWorkspaceLibraries = exports.getNpmPackageSharedConfig = exports.applyAdditionalShared = exports.applySharedFunction = void 0;
|
|
3
|
+
exports.readRootPackageJson = exports.getDependentPackagesForProject = exports.normalizeProjectName = exports.mapRemotesForSSR = exports.mapRemotes = exports.sharePackages = exports.shareWorkspaceLibraries = exports.getNpmPackageSharedConfig = exports.applyAdditionalShared = exports.applySharedFunction = void 0;
|
|
4
4
|
const share_1 = require("./share");
|
|
5
5
|
Object.defineProperty(exports, "applyAdditionalShared", { enumerable: true, get: function () { return share_1.applyAdditionalShared; } });
|
|
6
6
|
Object.defineProperty(exports, "applySharedFunction", { enumerable: true, get: function () { return share_1.applySharedFunction; } });
|
|
7
7
|
Object.defineProperty(exports, "getNpmPackageSharedConfig", { enumerable: true, get: function () { return share_1.getNpmPackageSharedConfig; } });
|
|
8
8
|
Object.defineProperty(exports, "sharePackages", { enumerable: true, get: function () { return share_1.sharePackages; } });
|
|
9
9
|
Object.defineProperty(exports, "shareWorkspaceLibraries", { enumerable: true, get: function () { return share_1.shareWorkspaceLibraries; } });
|
|
10
|
+
const normalize_project_name_1 = require("./normalize-project-name");
|
|
11
|
+
Object.defineProperty(exports, "normalizeProjectName", { enumerable: true, get: function () { return normalize_project_name_1.normalizeProjectName; } });
|
|
10
12
|
const remotes_1 = require("./remotes");
|
|
11
13
|
Object.defineProperty(exports, "mapRemotes", { enumerable: true, get: function () { return remotes_1.mapRemotes; } });
|
|
12
14
|
Object.defineProperty(exports, "mapRemotesForSSR", { enumerable: true, get: function () { return remotes_1.mapRemotesForSSR; } });
|
package/src/utils/remotes.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.mapRemotes = mapRemotes;
|
|
4
4
|
exports.mapRemotesForSSR = mapRemotesForSSR;
|
|
5
5
|
const url_helpers_1 = require("./url-helpers");
|
|
6
|
+
const normalize_project_name_1 = require("./normalize-project-name");
|
|
6
7
|
/**
|
|
7
8
|
* Map remote names to a format that can be understood and used by Module
|
|
8
9
|
* Federation.
|
|
@@ -15,12 +16,11 @@ function mapRemotes(remotes, remoteEntryExt, determineRemoteUrl, isRemoteGlobal
|
|
|
15
16
|
const mappedRemotes = {};
|
|
16
17
|
for (const nxRemoteProjectName of remotes) {
|
|
17
18
|
if (Array.isArray(nxRemoteProjectName)) {
|
|
18
|
-
const mfRemoteName =
|
|
19
|
+
const mfRemoteName = nxRemoteProjectName[0];
|
|
19
20
|
mappedRemotes[mfRemoteName] = handleArrayRemote(nxRemoteProjectName, remoteEntryExt, isRemoteGlobal);
|
|
20
21
|
}
|
|
21
22
|
else if (typeof nxRemoteProjectName === 'string') {
|
|
22
|
-
|
|
23
|
-
mappedRemotes[mfRemoteName] = handleStringRemote(nxRemoteProjectName, determineRemoteUrl, isRemoteGlobal);
|
|
23
|
+
mappedRemotes[nxRemoteProjectName] = handleStringRemote(nxRemoteProjectName, determineRemoteUrl, isRemoteGlobal);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
return mappedRemotes;
|
|
@@ -28,7 +28,7 @@ function mapRemotes(remotes, remoteEntryExt, determineRemoteUrl, isRemoteGlobal
|
|
|
28
28
|
// Helper function to deal with remotes that are arrays
|
|
29
29
|
function handleArrayRemote(remote, remoteEntryExt, isRemoteGlobal) {
|
|
30
30
|
const [nxRemoteProjectName, remoteLocation] = remote;
|
|
31
|
-
const mfRemoteName =
|
|
31
|
+
const mfRemoteName = (0, normalize_project_name_1.normalizeProjectName)(nxRemoteProjectName);
|
|
32
32
|
const finalRemoteUrl = (0, url_helpers_1.processRemoteLocation)(remoteLocation, remoteEntryExt);
|
|
33
33
|
// Promise-based remotes should not use the global prefix format
|
|
34
34
|
if (remoteLocation.startsWith('promise new Promise')) {
|
|
@@ -39,7 +39,7 @@ function handleArrayRemote(remote, remoteEntryExt, isRemoteGlobal) {
|
|
|
39
39
|
// Helper function to deal with remotes that are strings
|
|
40
40
|
function handleStringRemote(nxRemoteProjectName, determineRemoteUrl, isRemoteGlobal) {
|
|
41
41
|
const globalPrefix = isRemoteGlobal
|
|
42
|
-
? `${
|
|
42
|
+
? `${(0, normalize_project_name_1.normalizeProjectName)(nxRemoteProjectName)}@`
|
|
43
43
|
: '';
|
|
44
44
|
return `${globalPrefix}${determineRemoteUrl(nxRemoteProjectName)}`;
|
|
45
45
|
}
|
|
@@ -56,7 +56,7 @@ function mapRemotesForSSR(remotes, remoteEntryExt, determineRemoteUrl) {
|
|
|
56
56
|
for (const remote of remotes) {
|
|
57
57
|
if (Array.isArray(remote)) {
|
|
58
58
|
let [nxRemoteProjectName, remoteLocation] = remote;
|
|
59
|
-
const mfRemoteName =
|
|
59
|
+
const mfRemoteName = (0, normalize_project_name_1.normalizeProjectName)(nxRemoteProjectName);
|
|
60
60
|
const finalRemoteUrl = (0, url_helpers_1.processRemoteLocation)(remoteLocation, remoteEntryExt);
|
|
61
61
|
// Promise-based remotes should not use the global prefix format
|
|
62
62
|
if (remoteLocation.startsWith('promise new Promise')) {
|
|
@@ -67,12 +67,9 @@ function mapRemotesForSSR(remotes, remoteEntryExt, determineRemoteUrl) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
else if (typeof remote === 'string') {
|
|
70
|
-
const mfRemoteName =
|
|
71
|
-
mappedRemotes[
|
|
70
|
+
const mfRemoteName = (0, normalize_project_name_1.normalizeProjectName)(remote);
|
|
71
|
+
mappedRemotes[remote] = `${mfRemoteName}@${determineRemoteUrl(remote)}`;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return mappedRemotes;
|
|
75
75
|
}
|
|
76
|
-
function normalizeRemoteName(remote) {
|
|
77
|
-
return remote.replace(/-/g, '_');
|
|
78
|
-
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ModuleFederationConfig, type NxModuleFederationConfigOverride } from '../../utils';
|
|
2
2
|
export declare function withModuleFederationForSSR(options: ModuleFederationConfig, configOverride?: NxModuleFederationConfigOverride): Promise<(config: any) => any>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withModuleFederationForSSR = withModuleFederationForSSR;
|
|
4
|
-
const utils_1 = require("
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
5
6
|
async function withModuleFederationForSSR(options, configOverride) {
|
|
6
7
|
if (global.NX_GRAPH_CREATION) {
|
|
7
8
|
return (config) => config;
|
|
8
9
|
}
|
|
9
10
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
10
|
-
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0,
|
|
11
|
+
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options, {
|
|
11
12
|
isServer: true,
|
|
12
13
|
});
|
|
13
14
|
return (config) => {
|
|
@@ -34,7 +35,7 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
34
35
|
plugins: [
|
|
35
36
|
...(config.plugins ?? []),
|
|
36
37
|
new (require('@module-federation/enhanced').ModuleFederationPlugin)({
|
|
37
|
-
name:
|
|
38
|
+
name: (0, utils_1.normalizeProjectName)(options.name),
|
|
38
39
|
filename: 'remoteEntry.js',
|
|
39
40
|
exposes: options.exposes,
|
|
40
41
|
remotes: mappedRemotes,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ModuleFederationConfig, type NxModuleFederationConfigOverride } from '../../utils';
|
|
2
2
|
export declare function withModuleFederation(options: ModuleFederationConfig, configOverride?: NxModuleFederationConfigOverride): Promise<(config: any) => any>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withModuleFederation = withModuleFederation;
|
|
4
|
-
const utils_1 = require("
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
5
6
|
const webpack_1 = require("@module-federation/enhanced/webpack");
|
|
6
7
|
async function withModuleFederation(options, configOverride) {
|
|
7
8
|
if (global.NX_GRAPH_CREATION) {
|
|
8
9
|
return (config) => config;
|
|
9
10
|
}
|
|
10
11
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
11
|
-
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0,
|
|
12
|
+
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options);
|
|
12
13
|
return (config) => {
|
|
13
14
|
const updatedConfig = {
|
|
14
15
|
...(config ?? {}),
|
|
@@ -37,7 +38,7 @@ async function withModuleFederation(options, configOverride) {
|
|
|
37
38
|
plugins: [
|
|
38
39
|
...(config.plugins ?? []),
|
|
39
40
|
new webpack_1.ModuleFederationPlugin({
|
|
40
|
-
name:
|
|
41
|
+
name: (0, utils_1.normalizeProjectName)(options.name),
|
|
41
42
|
filename: 'remoteEntry.mjs',
|
|
42
43
|
exposes: options.exposes,
|
|
43
44
|
remotes: mappedRemotes,
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withModuleFederationForSSR = withModuleFederationForSSR;
|
|
4
4
|
const core_1 = require("@rspack/core");
|
|
5
|
-
const utils_1 = require("
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const utils_2 = require("./utils");
|
|
6
7
|
async function withModuleFederationForSSR(options, configOverride) {
|
|
7
8
|
if (global.NX_GRAPH_CREATION) {
|
|
8
9
|
return (config) => config;
|
|
9
10
|
}
|
|
10
11
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
11
|
-
const { sharedLibraries, sharedDependencies, mappedRemotes } = (0,
|
|
12
|
+
const { sharedLibraries, sharedDependencies, mappedRemotes } = (0, utils_2.getModuleFederationConfig)(options, {
|
|
12
13
|
isServer: true,
|
|
13
14
|
});
|
|
14
15
|
return (config, { context }) => {
|
|
@@ -26,7 +27,7 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
26
27
|
config.plugins.push(
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
28
29
|
new (require('@module-federation/enhanced/rspack').ModuleFederationPlugin)({
|
|
29
|
-
name:
|
|
30
|
+
name: (0, utils_1.normalizeProjectName)(options.name),
|
|
30
31
|
filename: 'remoteEntry.js',
|
|
31
32
|
exposes: options.exposes,
|
|
32
33
|
remotes: mappedRemotes,
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withModuleFederation = withModuleFederation;
|
|
4
4
|
const rspack_1 = require("@module-federation/enhanced/rspack");
|
|
5
5
|
const core_1 = require("@rspack/core");
|
|
6
|
-
const utils_1 = require("
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const utils_2 = require("./utils");
|
|
7
8
|
const isVarOrWindow = (libType) => libType === 'var' || libType === 'window';
|
|
8
9
|
/**
|
|
9
10
|
* @param {ModuleFederationConfig} options
|
|
@@ -16,7 +17,7 @@ async function withModuleFederation(options, configOverride) {
|
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
19
|
-
const { sharedDependencies, sharedLibraries, mappedRemotes } = (0,
|
|
20
|
+
const { sharedDependencies, sharedLibraries, mappedRemotes } = (0, utils_2.getModuleFederationConfig)(options);
|
|
20
21
|
const isGlobal = isVarOrWindow(options.library?.type);
|
|
21
22
|
return function makeConfig(config, { context }) {
|
|
22
23
|
config.output.uniqueName = options.name;
|
|
@@ -36,7 +37,7 @@ async function withModuleFederation(options, configOverride) {
|
|
|
36
37
|
config.optimization.runtimeChunk = 'single';
|
|
37
38
|
}
|
|
38
39
|
config.plugins.push(new rspack_1.ModuleFederationPlugin({
|
|
39
|
-
name:
|
|
40
|
+
name: (0, utils_1.normalizeProjectName)(options.name),
|
|
40
41
|
filename: 'remoteEntry.js',
|
|
41
42
|
exposes: options.exposes,
|
|
42
43
|
remotes: mappedRemotes,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withModuleFederationForSSR = withModuleFederationForSSR;
|
|
4
|
-
const utils_1 = require("
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
5
6
|
async function withModuleFederationForSSR(options, configOverride) {
|
|
6
7
|
if (global.NX_GRAPH_CREATION) {
|
|
7
8
|
return (config) => config;
|
|
8
9
|
}
|
|
9
10
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
10
|
-
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0,
|
|
11
|
+
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options, {
|
|
11
12
|
isServer: true,
|
|
12
13
|
});
|
|
13
14
|
return (config) => {
|
|
@@ -20,7 +21,7 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
20
21
|
: false,
|
|
21
22
|
};
|
|
22
23
|
config.plugins.push(new (require('@module-federation/enhanced').ModuleFederationPlugin)({
|
|
23
|
-
name:
|
|
24
|
+
name: (0, utils_1.normalizeProjectName)(options.name),
|
|
24
25
|
filename: 'remoteEntry.js',
|
|
25
26
|
exposes: options.exposes,
|
|
26
27
|
remotes: mappedRemotes,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withModuleFederation = withModuleFederation;
|
|
4
|
-
const utils_1 = require("
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
5
6
|
const webpack_1 = require("@module-federation/enhanced/webpack");
|
|
6
7
|
/**
|
|
7
8
|
* @param {ModuleFederationConfig} options
|
|
@@ -11,7 +12,7 @@ async function withModuleFederation(options, configOverride) {
|
|
|
11
12
|
return (config) => config;
|
|
12
13
|
}
|
|
13
14
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
14
|
-
const { sharedDependencies, sharedLibraries, mappedRemotes } = await (0,
|
|
15
|
+
const { sharedDependencies, sharedLibraries, mappedRemotes } = await (0, utils_2.getModuleFederationConfig)(options);
|
|
15
16
|
return (config, ctx) => {
|
|
16
17
|
config.output.uniqueName = options.name;
|
|
17
18
|
config.output.publicPath = 'auto';
|
|
@@ -28,7 +29,7 @@ async function withModuleFederation(options, configOverride) {
|
|
|
28
29
|
config.optimization.runtimeChunk = 'single';
|
|
29
30
|
}
|
|
30
31
|
config.plugins.push(new webpack_1.ModuleFederationPlugin({
|
|
31
|
-
name:
|
|
32
|
+
name: (0, utils_1.normalizeProjectName)(options.name),
|
|
32
33
|
filename: 'remoteEntry.js',
|
|
33
34
|
exposes: options.exposes,
|
|
34
35
|
remotes: mappedRemotes,
|