@module-federation/modern-js 0.14.2 → 0.15.0
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/dist/LICENSE +21 -0
- package/dist/cjs/cli/configPlugin.js +381 -0
- package/dist/cjs/cli/configPlugin.spec.js +114 -0
- package/dist/cjs/cli/index.js +95 -0
- package/dist/cjs/cli/mfRuntimePlugins/auto-fetch-data.js +98 -0
- package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +44 -0
- package/dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js +82 -0
- package/dist/cjs/cli/mfRuntimePlugins/shared-strategy.js +43 -0
- package/dist/cjs/cli/server/data-fetch-server-plugin.js +189 -0
- package/dist/cjs/cli/ssrPlugin.js +236 -0
- package/dist/cjs/cli/utils.js +90 -0
- package/dist/cjs/constant.js +78 -0
- package/dist/cjs/interfaces/bundler.js +16 -0
- package/dist/cjs/interfaces/global.js +16 -0
- package/dist/cjs/logger.js +27 -0
- package/dist/cjs/runtime/AwaitDataFetch.js +144 -0
- package/dist/cjs/runtime/createRemoteComponent.js +327 -0
- package/dist/cjs/runtime/index.js +50 -0
- package/dist/cjs/runtime/wrapNoSSR.js +35 -0
- package/dist/cjs/server/fileCache.js +84 -0
- package/dist/cjs/server/fileCache.spec.js +28 -0
- package/dist/cjs/server/index.js +58 -0
- package/dist/cjs/server/staticMiddleware.js +77 -0
- package/dist/cjs/server/staticMiddleware.spec.js +185 -0
- package/dist/cjs/ssr-runtime/SSRLiveReload.js +43 -0
- package/dist/cjs/ssr-runtime/devPlugin.js +71 -0
- package/dist/cjs/ssr-runtime/downgrade.js +114 -0
- package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +136 -0
- package/dist/cjs/types/index.js +16 -0
- package/dist/cjs/utils/dataFetch.js +211 -0
- package/dist/cjs/utils/index.js +54 -0
- package/dist/esm/cli/configPlugin.js +388 -0
- package/dist/esm/cli/configPlugin.spec.js +110 -0
- package/dist/esm/cli/index.js +90 -0
- package/dist/esm/cli/mfRuntimePlugins/auto-fetch-data.js +74 -0
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js +16 -0
- package/dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js +74 -0
- package/dist/esm/cli/mfRuntimePlugins/shared-strategy.js +25 -0
- package/dist/esm/cli/server/data-fetch-server-plugin.js +237 -0
- package/dist/esm/cli/ssrPlugin.js +219 -0
- package/dist/esm/cli/utils.js +53 -0
- package/dist/esm/constant.js +42 -0
- package/dist/esm/interfaces/bundler.js +0 -0
- package/dist/esm/interfaces/global.js +0 -0
- package/dist/esm/logger.js +7 -0
- package/dist/esm/runtime/AwaitDataFetch.js +131 -0
- package/dist/esm/runtime/createRemoteComponent.js +417 -0
- package/dist/esm/runtime/index.js +22 -0
- package/dist/esm/runtime/wrapNoSSR.js +12 -0
- package/dist/esm/server/fileCache.js +98 -0
- package/dist/esm/server/fileCache.spec.js +50 -0
- package/dist/esm/server/index.js +36 -0
- package/dist/esm/server/staticMiddleware.js +81 -0
- package/dist/esm/server/staticMiddleware.spec.js +328 -0
- package/dist/esm/ssr-runtime/SSRLiveReload.js +26 -0
- package/dist/esm/ssr-runtime/devPlugin.js +73 -0
- package/dist/esm/ssr-runtime/downgrade.js +150 -0
- package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.js +177 -0
- package/dist/esm/types/index.js +0 -0
- package/dist/esm/utils/dataFetch.js +237 -0
- package/dist/esm/utils/index.js +28 -0
- package/dist/esm-node/cli/configPlugin.js +340 -0
- package/dist/esm-node/cli/configPlugin.spec.js +91 -0
- package/dist/esm-node/cli/index.js +70 -0
- package/dist/esm-node/cli/mfRuntimePlugins/auto-fetch-data.js +68 -0
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.js +14 -0
- package/dist/esm-node/cli/mfRuntimePlugins/resolve-entry-ipv4.js +62 -0
- package/dist/esm-node/cli/mfRuntimePlugins/shared-strategy.js +23 -0
- package/dist/esm-node/cli/server/data-fetch-server-plugin.js +159 -0
- package/dist/esm-node/cli/ssrPlugin.js +200 -0
- package/dist/esm-node/cli/utils.js +53 -0
- package/dist/esm-node/constant.js +42 -0
- package/dist/esm-node/interfaces/bundler.js +0 -0
- package/dist/esm-node/interfaces/global.js +0 -0
- package/dist/esm-node/logger.js +7 -0
- package/dist/esm-node/runtime/AwaitDataFetch.js +109 -0
- package/dist/esm-node/runtime/createRemoteComponent.js +291 -0
- package/dist/esm-node/runtime/index.js +22 -0
- package/dist/esm-node/runtime/wrapNoSSR.js +11 -0
- package/dist/esm-node/server/fileCache.js +49 -0
- package/dist/esm-node/server/fileCache.spec.js +27 -0
- package/dist/esm-node/server/index.js +34 -0
- package/dist/esm-node/server/staticMiddleware.js +43 -0
- package/dist/esm-node/server/staticMiddleware.spec.js +162 -0
- package/dist/esm-node/ssr-runtime/SSRLiveReload.js +19 -0
- package/dist/esm-node/ssr-runtime/devPlugin.js +37 -0
- package/dist/esm-node/ssr-runtime/downgrade.js +88 -0
- package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.js +101 -0
- package/dist/esm-node/types/index.js +0 -0
- package/dist/esm-node/utils/dataFetch.js +166 -0
- package/dist/esm-node/utils/index.js +27 -0
- package/dist/types/cli/configPlugin.d.ts +21 -0
- package/dist/types/cli/configPlugin.spec.d.ts +1 -0
- package/dist/types/cli/index.d.ts +6 -0
- package/dist/types/cli/mfRuntimePlugins/auto-fetch-data.d.ts +3 -0
- package/dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts +3 -0
- package/dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts +3 -0
- package/dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts +3 -0
- package/dist/types/cli/server/data-fetch-server-plugin.d.ts +3 -0
- package/dist/types/cli/ssrPlugin.d.ts +6 -0
- package/dist/types/cli/utils.d.ts +6 -0
- package/dist/types/constant.d.ts +25 -0
- package/dist/types/interfaces/bundler.d.ts +18 -0
- package/dist/types/interfaces/global.d.ts +27 -0
- package/dist/types/logger.d.ts +2 -0
- package/dist/types/runtime/AwaitDataFetch.d.ts +19 -0
- package/dist/types/runtime/createRemoteComponent.d.ts +26 -0
- package/dist/types/runtime/index.d.ts +10 -0
- package/dist/types/runtime/wrapNoSSR.d.ts +9 -0
- package/dist/types/server/fileCache.d.ts +14 -0
- package/dist/types/server/fileCache.spec.d.ts +1 -0
- package/dist/types/server/index.d.ts +4 -0
- package/dist/types/server/staticMiddleware.d.ts +6 -0
- package/dist/types/server/staticMiddleware.spec.d.ts +1 -0
- package/dist/types/ssr-runtime/SSRLiveReload.d.ts +1 -0
- package/dist/types/ssr-runtime/devPlugin.d.ts +2 -0
- package/dist/types/ssr-runtime/downgrade.d.ts +4 -0
- package/dist/types/ssr-runtime/injectDataFetchFunctionPlugin.d.ts +7 -0
- package/dist/types/types/index.d.ts +24 -0
- package/dist/types/utils/dataFetch.d.ts +26 -0
- package/dist/types/utils/index.d.ts +15 -0
- package/package.json +37 -12
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present zhanghang(2heal1)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var configPlugin_exports = {};
|
|
30
|
+
__export(configPlugin_exports, {
|
|
31
|
+
addMyTypes2Ignored: () => addMyTypes2Ignored,
|
|
32
|
+
default: () => configPlugin_default,
|
|
33
|
+
getMFConfig: () => getMFConfig,
|
|
34
|
+
isWebTarget: () => import_utils.isWebTarget,
|
|
35
|
+
moduleFederationConfigPlugin: () => moduleFederationConfigPlugin,
|
|
36
|
+
patchBundlerConfig: () => patchBundlerConfig,
|
|
37
|
+
patchMFConfig: () => patchMFConfig,
|
|
38
|
+
setEnv: () => setEnv,
|
|
39
|
+
skipByTarget: () => import_utils.skipByTarget
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(configPlugin_exports);
|
|
42
|
+
var import_path = __toESM(require("path"));
|
|
43
|
+
var import_utils = require("./utils");
|
|
44
|
+
var import_sdk = require("@module-federation/sdk");
|
|
45
|
+
var import_node_bundle_require = require("@modern-js/node-bundle-require");
|
|
46
|
+
var import_constant = require("../constant");
|
|
47
|
+
var import_utils2 = require("@module-federation/rsbuild-plugin/utils");
|
|
48
|
+
var import_logger = __toESM(require("../logger"));
|
|
49
|
+
var import_utils3 = require("./utils");
|
|
50
|
+
const defaultPath = import_path.default.resolve(process.cwd(), "module-federation.config.ts");
|
|
51
|
+
function setEnv(enableSSR) {
|
|
52
|
+
if (enableSSR) {
|
|
53
|
+
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
|
54
|
+
process.env["MF_SSR_PRJ"] = "true";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const getMFConfig = async (userConfig) => {
|
|
58
|
+
const { config, configPath } = userConfig;
|
|
59
|
+
if (config) {
|
|
60
|
+
return config;
|
|
61
|
+
}
|
|
62
|
+
const mfConfigPath = configPath ? configPath : defaultPath;
|
|
63
|
+
const preBundlePath = await (0, import_node_bundle_require.bundle)(mfConfigPath);
|
|
64
|
+
const mfConfig = (await Promise.resolve().then(() => __toESM(require(preBundlePath)))).default;
|
|
65
|
+
return mfConfig;
|
|
66
|
+
};
|
|
67
|
+
const injectRuntimePlugins = (runtimePlugin, runtimePlugins) => {
|
|
68
|
+
if (!runtimePlugins.includes(runtimePlugin)) {
|
|
69
|
+
runtimePlugins.push(runtimePlugin);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const replaceRemoteUrl = (mfConfig, remoteIpStrategy) => {
|
|
73
|
+
if (remoteIpStrategy && remoteIpStrategy === "inherit") {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!mfConfig.remotes) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const ipv4 = (0, import_utils.getIPV4)();
|
|
80
|
+
const handleRemoteObject = (remoteObject) => {
|
|
81
|
+
Object.keys(remoteObject).forEach((remoteKey) => {
|
|
82
|
+
const remote = remoteObject[remoteKey];
|
|
83
|
+
if (Array.isArray(remote)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (typeof remote === "string" && remote.includes(import_constant.LOCALHOST)) {
|
|
87
|
+
remoteObject[remoteKey] = remote.replace(import_constant.LOCALHOST, ipv4);
|
|
88
|
+
}
|
|
89
|
+
if (typeof remote === "object" && !Array.isArray(remote.external) && remote.external.includes(import_constant.LOCALHOST)) {
|
|
90
|
+
remote.external = remote.external.replace(import_constant.LOCALHOST, ipv4);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
if (Array.isArray(mfConfig.remotes)) {
|
|
95
|
+
mfConfig.remotes.forEach((remoteObject) => {
|
|
96
|
+
if (typeof remoteObject === "string") {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
handleRemoteObject(remoteObject);
|
|
100
|
+
});
|
|
101
|
+
} else if (typeof mfConfig.remotes !== "string") {
|
|
102
|
+
handleRemoteObject(mfConfig.remotes);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const patchDTSConfig = (mfConfig, isServer) => {
|
|
106
|
+
if (isServer) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const ModernJSRuntime = "@module-federation/modern-js/runtime";
|
|
110
|
+
if (mfConfig.dts !== false) {
|
|
111
|
+
var _mfConfig_dts, _mfConfig_dts1;
|
|
112
|
+
if (typeof mfConfig.dts === "boolean" || mfConfig.dts === void 0) {
|
|
113
|
+
mfConfig.dts = {
|
|
114
|
+
consumeTypes: {
|
|
115
|
+
runtimePkgs: [
|
|
116
|
+
ModernJSRuntime
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
} else if (((_mfConfig_dts = mfConfig.dts) === null || _mfConfig_dts === void 0 ? void 0 : _mfConfig_dts.consumeTypes) || ((_mfConfig_dts1 = mfConfig.dts) === null || _mfConfig_dts1 === void 0 ? void 0 : _mfConfig_dts1.consumeTypes) === void 0) {
|
|
121
|
+
var _mfConfig_dts2;
|
|
122
|
+
if (typeof mfConfig.dts.consumeTypes === "boolean" || ((_mfConfig_dts2 = mfConfig.dts) === null || _mfConfig_dts2 === void 0 ? void 0 : _mfConfig_dts2.consumeTypes) === void 0) {
|
|
123
|
+
mfConfig.dts.consumeTypes = {
|
|
124
|
+
runtimePkgs: [
|
|
125
|
+
ModernJSRuntime
|
|
126
|
+
]
|
|
127
|
+
};
|
|
128
|
+
} else {
|
|
129
|
+
mfConfig.dts.consumeTypes.runtimePkgs = mfConfig.dts.consumeTypes.runtimePkgs || [];
|
|
130
|
+
if (!mfConfig.dts.consumeTypes.runtimePkgs.includes(ModernJSRuntime)) {
|
|
131
|
+
mfConfig.dts.consumeTypes.runtimePkgs.push(ModernJSRuntime);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR) => {
|
|
138
|
+
replaceRemoteUrl(mfConfig, remoteIpStrategy);
|
|
139
|
+
(0, import_utils2.addDataFetchExposes)(mfConfig.exposes, isServer);
|
|
140
|
+
if (mfConfig.remoteType === void 0) {
|
|
141
|
+
mfConfig.remoteType = "script";
|
|
142
|
+
}
|
|
143
|
+
if (!mfConfig.name) {
|
|
144
|
+
throw new Error(`${import_constant.PLUGIN_IDENTIFIER} mfConfig.name can not be empty!`);
|
|
145
|
+
}
|
|
146
|
+
const runtimePlugins = [
|
|
147
|
+
...mfConfig.runtimePlugins || []
|
|
148
|
+
];
|
|
149
|
+
patchDTSConfig(mfConfig, isServer);
|
|
150
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
151
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/auto-fetch-data"), runtimePlugins);
|
|
152
|
+
if (enableSSR && (0, import_utils3.isDev)()) {
|
|
153
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/resolve-entry-ipv4"), runtimePlugins);
|
|
154
|
+
}
|
|
155
|
+
if (isServer) {
|
|
156
|
+
injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
|
|
157
|
+
if ((0, import_utils3.isDev)()) {
|
|
158
|
+
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
159
|
+
}
|
|
160
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
161
|
+
if (!mfConfig.library) {
|
|
162
|
+
mfConfig.library = {
|
|
163
|
+
type: "commonjs-module",
|
|
164
|
+
name: mfConfig.name
|
|
165
|
+
};
|
|
166
|
+
} else {
|
|
167
|
+
if (!mfConfig.library.type) {
|
|
168
|
+
mfConfig.library.type = "commonjs-module";
|
|
169
|
+
}
|
|
170
|
+
if (!mfConfig.library.name) {
|
|
171
|
+
mfConfig.library.name = mfConfig.name;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
mfConfig.runtimePlugins = runtimePlugins;
|
|
176
|
+
if (!isServer) {
|
|
177
|
+
var _mfConfig_library;
|
|
178
|
+
if (((_mfConfig_library = mfConfig.library) === null || _mfConfig_library === void 0 ? void 0 : _mfConfig_library.type) === "commonjs-module") {
|
|
179
|
+
mfConfig.library.type = "global";
|
|
180
|
+
}
|
|
181
|
+
return mfConfig;
|
|
182
|
+
}
|
|
183
|
+
mfConfig.dts = false;
|
|
184
|
+
mfConfig.dev = false;
|
|
185
|
+
return mfConfig;
|
|
186
|
+
};
|
|
187
|
+
function patchIgnoreWarning(chain) {
|
|
188
|
+
const ignoreWarnings = chain.get("ignoreWarnings") || [];
|
|
189
|
+
const ignoredMsgs = [
|
|
190
|
+
"external script",
|
|
191
|
+
"process.env.WS_NO_BUFFER_UTIL",
|
|
192
|
+
`Can't resolve 'utf-8-validate`
|
|
193
|
+
];
|
|
194
|
+
ignoreWarnings.push((warning) => {
|
|
195
|
+
if (ignoredMsgs.some((msg) => warning.message.includes(msg))) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
});
|
|
200
|
+
chain.ignoreWarnings(ignoreWarnings);
|
|
201
|
+
}
|
|
202
|
+
function addMyTypes2Ignored(chain, mfConfig) {
|
|
203
|
+
const watchOptions = chain.get("watchOptions");
|
|
204
|
+
if (!watchOptions || !watchOptions.ignored) {
|
|
205
|
+
chain.watchOptions({
|
|
206
|
+
ignored: /[\\/](?:\.git|node_modules|@mf-types)[\\/]/
|
|
207
|
+
});
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const ignored = watchOptions.ignored;
|
|
211
|
+
const DEFAULT_IGNORED_GLOB = "**/@mf-types/**";
|
|
212
|
+
if (Array.isArray(ignored)) {
|
|
213
|
+
if (mfConfig.dts !== false && typeof mfConfig.dts === "object" && typeof mfConfig.dts.consumeTypes === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
|
|
214
|
+
chain.watchOptions({
|
|
215
|
+
...watchOptions,
|
|
216
|
+
ignored: ignored.concat(`**/${mfConfig.dts.consumeTypes.remoteTypesFolder}/**`)
|
|
217
|
+
});
|
|
218
|
+
} else {
|
|
219
|
+
chain.watchOptions({
|
|
220
|
+
...watchOptions,
|
|
221
|
+
ignored: ignored.concat(DEFAULT_IGNORED_GLOB)
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (typeof ignored !== "string") {
|
|
227
|
+
chain.watchOptions({
|
|
228
|
+
...watchOptions,
|
|
229
|
+
ignored: /[\\/](?:\.git|node_modules|@mf-types)[\\/]/
|
|
230
|
+
});
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
chain.watchOptions({
|
|
234
|
+
...watchOptions,
|
|
235
|
+
ignored: ignored.concat(DEFAULT_IGNORED_GLOB)
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function patchBundlerConfig(options) {
|
|
239
|
+
var _modernjsConfig_deploy;
|
|
240
|
+
const { chain, modernjsConfig, isServer, mfConfig, enableSSR } = options;
|
|
241
|
+
chain.optimization.delete("runtimeChunk");
|
|
242
|
+
patchIgnoreWarning(chain);
|
|
243
|
+
if (!chain.output.get("chunkLoadingGlobal")) {
|
|
244
|
+
chain.output.chunkLoadingGlobal(`chunk_${mfConfig.name}`);
|
|
245
|
+
}
|
|
246
|
+
if (!chain.output.get("uniqueName")) {
|
|
247
|
+
chain.output.uniqueName(mfConfig.name);
|
|
248
|
+
}
|
|
249
|
+
const splitChunkConfig = chain.optimization.splitChunks.entries();
|
|
250
|
+
if (!isServer) {
|
|
251
|
+
(0, import_utils2.autoDeleteSplitChunkCacheGroups)(mfConfig, splitChunkConfig);
|
|
252
|
+
}
|
|
253
|
+
if (!isServer && enableSSR && splitChunkConfig && typeof splitChunkConfig === "object" && splitChunkConfig.cacheGroups) {
|
|
254
|
+
splitChunkConfig.chunks = "async";
|
|
255
|
+
import_logger.default.warn(`splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
|
|
256
|
+
}
|
|
257
|
+
if ((0, import_utils3.isDev)() && chain.output.get("publicPath") === "auto") {
|
|
258
|
+
var _modernjsConfig_dev, _modernjsConfig_server;
|
|
259
|
+
const port = ((_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.port) || ((_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.port) || 8080;
|
|
260
|
+
const publicPath = `http://localhost:${port}/`;
|
|
261
|
+
chain.output.publicPath(publicPath);
|
|
262
|
+
}
|
|
263
|
+
if (isServer && enableSSR) {
|
|
264
|
+
const uniqueName = mfConfig.name || chain.output.get("uniqueName");
|
|
265
|
+
const chunkFileName = chain.output.get("chunkFilename");
|
|
266
|
+
if (typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
267
|
+
const suffix = `${(0, import_sdk.encodeName)(uniqueName)}-[chunkhash].js`;
|
|
268
|
+
chain.output.chunkFilename(chunkFileName.replace(".js", suffix));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if ((0, import_utils3.isDev)() && enableSSR && !isServer) {
|
|
272
|
+
chain.resolve.fallback.set("crypto", false).set("stream", false).set("vm", false);
|
|
273
|
+
}
|
|
274
|
+
if (((_modernjsConfig_deploy = modernjsConfig.deploy) === null || _modernjsConfig_deploy === void 0 ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length) {
|
|
275
|
+
chain.optimization.usedExports(false);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const moduleFederationConfigPlugin = (userConfig) => ({
|
|
279
|
+
name: "@modern-js/plugin-module-federation-config",
|
|
280
|
+
pre: [
|
|
281
|
+
"@modern-js/plugin-initialize"
|
|
282
|
+
],
|
|
283
|
+
post: [
|
|
284
|
+
"@modern-js/plugin-module-federation"
|
|
285
|
+
],
|
|
286
|
+
setup: async (api) => {
|
|
287
|
+
var _userConfig_userConfig, _modernjsConfig_server;
|
|
288
|
+
const modernjsConfig = api.getConfig();
|
|
289
|
+
const mfConfig = await getMFConfig(userConfig.originPluginOptions);
|
|
290
|
+
const csrConfig = userConfig.csrConfig || JSON.parse(JSON.stringify(mfConfig));
|
|
291
|
+
const ssrConfig = userConfig.ssrConfig || JSON.parse(JSON.stringify(mfConfig));
|
|
292
|
+
userConfig.ssrConfig = ssrConfig;
|
|
293
|
+
userConfig.csrConfig = csrConfig;
|
|
294
|
+
var _userConfig_userConfig_ssr;
|
|
295
|
+
const enableSSR = Boolean((_userConfig_userConfig_ssr = (_userConfig_userConfig = userConfig.userConfig) === null || _userConfig_userConfig === void 0 ? void 0 : _userConfig_userConfig.ssr) !== null && _userConfig_userConfig_ssr !== void 0 ? _userConfig_userConfig_ssr : Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr));
|
|
296
|
+
api.modifyBundlerChain((chain) => {
|
|
297
|
+
const target = chain.get("target");
|
|
298
|
+
if ((0, import_utils.skipByTarget)(target)) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const isWeb = (0, import_utils.isWebTarget)(target);
|
|
302
|
+
addMyTypes2Ignored(chain, !isWeb ? ssrConfig : csrConfig);
|
|
303
|
+
const targetMFConfig = !isWeb ? ssrConfig : csrConfig;
|
|
304
|
+
patchMFConfig(targetMFConfig, !isWeb, userConfig.remoteIpStrategy || "ipv4", enableSSR);
|
|
305
|
+
patchBundlerConfig({
|
|
306
|
+
chain,
|
|
307
|
+
isServer: !isWeb,
|
|
308
|
+
modernjsConfig,
|
|
309
|
+
mfConfig,
|
|
310
|
+
enableSSR
|
|
311
|
+
});
|
|
312
|
+
userConfig.distOutputDir = chain.output.get("path") || import_path.default.resolve(process.cwd(), "dist");
|
|
313
|
+
});
|
|
314
|
+
api.config(() => {
|
|
315
|
+
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_source, _modernjsConfig_source1, _modernjsConfig_dev;
|
|
316
|
+
const bundlerType = api.getAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
|
|
317
|
+
const ipv4 = (0, import_utils.getIPV4)();
|
|
318
|
+
if (userConfig.remoteIpStrategy === void 0) {
|
|
319
|
+
if (!enableSSR) {
|
|
320
|
+
userConfig.remoteIpStrategy = "inherit";
|
|
321
|
+
} else {
|
|
322
|
+
userConfig.remoteIpStrategy = "ipv4";
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const devServerConfig = (_modernjsConfig_tools = modernjsConfig.tools) === null || _modernjsConfig_tools === void 0 ? void 0 : _modernjsConfig_tools.devServer;
|
|
326
|
+
const corsWarnMsgs = [
|
|
327
|
+
"View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details."
|
|
328
|
+
];
|
|
329
|
+
if (typeof devServerConfig !== "object" || !("headers" in devServerConfig)) {
|
|
330
|
+
corsWarnMsgs.unshift('Detect devServer.headers is empty, mf modern plugin will add default cors header: devServer.headers["Access-Control-Allow-Headers"] = "*". It is recommended to specify an allowlist of trusted origins instead.');
|
|
331
|
+
}
|
|
332
|
+
const exposes = (_userConfig_csrConfig = userConfig.csrConfig) === null || _userConfig_csrConfig === void 0 ? void 0 : _userConfig_csrConfig.exposes;
|
|
333
|
+
const hasExposes = exposes && Array.isArray(exposes) ? exposes.length : Object.keys(exposes !== null && exposes !== void 0 ? exposes : {}).length;
|
|
334
|
+
if (corsWarnMsgs.length > 1 && hasExposes) {
|
|
335
|
+
import_logger.default.warn(corsWarnMsgs.join("\n"));
|
|
336
|
+
}
|
|
337
|
+
const corsHeaders = hasExposes ? {
|
|
338
|
+
"Access-Control-Allow-Origin": "*",
|
|
339
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
|
340
|
+
"Access-Control-Allow-Headers": "*"
|
|
341
|
+
} : void 0;
|
|
342
|
+
const defineConfig = {
|
|
343
|
+
REMOTE_IP_STRATEGY: JSON.stringify(userConfig.remoteIpStrategy)
|
|
344
|
+
};
|
|
345
|
+
if (enableSSR && (0, import_utils3.isDev)()) {
|
|
346
|
+
defineConfig["FEDERATION_IPV4"] = JSON.stringify(ipv4);
|
|
347
|
+
}
|
|
348
|
+
var _modernjsConfig_source_enableAsyncEntry;
|
|
349
|
+
return {
|
|
350
|
+
tools: {
|
|
351
|
+
devServer: {
|
|
352
|
+
headers: corsHeaders
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
source: {
|
|
356
|
+
alias: {
|
|
357
|
+
// TODO: deprecated
|
|
358
|
+
"@modern-js/runtime/mf": require.resolve("@module-federation/modern-js/runtime")
|
|
359
|
+
},
|
|
360
|
+
define: defineConfig,
|
|
361
|
+
enableAsyncEntry: bundlerType === "rspack" ? (_modernjsConfig_source_enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry) !== null && _modernjsConfig_source_enableAsyncEntry !== void 0 ? _modernjsConfig_source_enableAsyncEntry : true : (_modernjsConfig_source1 = modernjsConfig.source) === null || _modernjsConfig_source1 === void 0 ? void 0 : _modernjsConfig_source1.enableAsyncEntry
|
|
362
|
+
},
|
|
363
|
+
dev: {
|
|
364
|
+
assetPrefix: (modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_dev = modernjsConfig.dev) === null || _modernjsConfig_dev === void 0 ? void 0 : _modernjsConfig_dev.assetPrefix) ? modernjsConfig.dev.assetPrefix : true
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
var configPlugin_default = moduleFederationConfigPlugin;
|
|
371
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
372
|
+
0 && (module.exports = {
|
|
373
|
+
addMyTypes2Ignored,
|
|
374
|
+
getMFConfig,
|
|
375
|
+
isWebTarget,
|
|
376
|
+
moduleFederationConfigPlugin,
|
|
377
|
+
patchBundlerConfig,
|
|
378
|
+
patchMFConfig,
|
|
379
|
+
setEnv,
|
|
380
|
+
skipByTarget
|
|
381
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var import_vitest = require("vitest");
|
|
25
|
+
var import_configPlugin = require("./configPlugin");
|
|
26
|
+
var import_utils = require("./utils");
|
|
27
|
+
const mfConfig = {
|
|
28
|
+
name: "host",
|
|
29
|
+
filename: "remoteEntry.js",
|
|
30
|
+
remotes: {
|
|
31
|
+
remote: "http://localhost:3000/remoteEntry.js"
|
|
32
|
+
},
|
|
33
|
+
shared: {
|
|
34
|
+
react: {
|
|
35
|
+
singleton: true,
|
|
36
|
+
eager: true
|
|
37
|
+
},
|
|
38
|
+
"react-dom": {
|
|
39
|
+
singleton: true,
|
|
40
|
+
eager: true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
(0, import_vitest.describe)("patchMFConfig", async () => {
|
|
45
|
+
(0, import_vitest.it)("patchMFConfig: server", async () => {
|
|
46
|
+
const patchedConfig = JSON.parse(JSON.stringify(mfConfig));
|
|
47
|
+
(0, import_configPlugin.patchMFConfig)(patchedConfig, true);
|
|
48
|
+
const ipv4 = (0, import_utils.getIPV4)();
|
|
49
|
+
(0, import_vitest.expect)(patchedConfig).toStrictEqual({
|
|
50
|
+
dev: false,
|
|
51
|
+
dts: false,
|
|
52
|
+
filename: "remoteEntry.js",
|
|
53
|
+
library: {
|
|
54
|
+
name: "host",
|
|
55
|
+
type: "commonjs-module"
|
|
56
|
+
},
|
|
57
|
+
name: "host",
|
|
58
|
+
remotes: {
|
|
59
|
+
remote: `http://${ipv4}:3000/remoteEntry.js`
|
|
60
|
+
},
|
|
61
|
+
remoteType: "script",
|
|
62
|
+
runtimePlugins: [
|
|
63
|
+
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
64
|
+
require.resolve("@module-federation/modern-js/auto-fetch-data"),
|
|
65
|
+
require.resolve("@module-federation/node/runtimePlugin"),
|
|
66
|
+
require.resolve("@module-federation/modern-js/inject-node-fetch")
|
|
67
|
+
],
|
|
68
|
+
shared: {
|
|
69
|
+
react: {
|
|
70
|
+
eager: true,
|
|
71
|
+
singleton: true
|
|
72
|
+
},
|
|
73
|
+
"react-dom": {
|
|
74
|
+
eager: true,
|
|
75
|
+
singleton: true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
(0, import_vitest.it)("patchMFConfig: client", async () => {
|
|
81
|
+
const patchedConfig = JSON.parse(JSON.stringify(mfConfig));
|
|
82
|
+
(0, import_configPlugin.patchMFConfig)(patchedConfig, false);
|
|
83
|
+
const ipv4 = (0, import_utils.getIPV4)();
|
|
84
|
+
(0, import_vitest.expect)(patchedConfig).toStrictEqual({
|
|
85
|
+
filename: "remoteEntry.js",
|
|
86
|
+
name: "host",
|
|
87
|
+
remotes: {
|
|
88
|
+
remote: `http://${ipv4}:3000/remoteEntry.js`
|
|
89
|
+
},
|
|
90
|
+
remoteType: "script",
|
|
91
|
+
runtimePlugins: [
|
|
92
|
+
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
93
|
+
require.resolve("@module-federation/modern-js/auto-fetch-data")
|
|
94
|
+
],
|
|
95
|
+
shared: {
|
|
96
|
+
react: {
|
|
97
|
+
eager: true,
|
|
98
|
+
singleton: true
|
|
99
|
+
},
|
|
100
|
+
"react-dom": {
|
|
101
|
+
eager: true,
|
|
102
|
+
singleton: true
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
dts: {
|
|
106
|
+
consumeTypes: {
|
|
107
|
+
runtimePkgs: [
|
|
108
|
+
"@module-federation/modern-js/runtime"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var cli_exports = {};
|
|
20
|
+
__export(cli_exports, {
|
|
21
|
+
createModuleFederationConfig: () => import_enhanced2.createModuleFederationConfig,
|
|
22
|
+
default: () => cli_default,
|
|
23
|
+
moduleFederationPlugin: () => moduleFederationPlugin
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(cli_exports);
|
|
26
|
+
var import_enhanced = require("@module-federation/enhanced");
|
|
27
|
+
var import_rspack = require("@module-federation/enhanced/rspack");
|
|
28
|
+
var import_configPlugin = require("./configPlugin");
|
|
29
|
+
var import_ssrPlugin = require("./ssrPlugin");
|
|
30
|
+
var import_utils = require("./utils");
|
|
31
|
+
var import_enhanced2 = require("@module-federation/enhanced");
|
|
32
|
+
const moduleFederationPlugin = (userConfig = {}) => {
|
|
33
|
+
var _userConfig_fetchServerQuery;
|
|
34
|
+
const internalModernPluginOptions = {
|
|
35
|
+
csrConfig: void 0,
|
|
36
|
+
ssrConfig: void 0,
|
|
37
|
+
browserPlugin: void 0,
|
|
38
|
+
nodePlugin: void 0,
|
|
39
|
+
distOutputDir: "",
|
|
40
|
+
originPluginOptions: userConfig,
|
|
41
|
+
remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
|
|
42
|
+
userConfig: userConfig || {},
|
|
43
|
+
fetchServerQuery: (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) !== null && _userConfig_fetchServerQuery !== void 0 ? _userConfig_fetchServerQuery : void 0
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
name: "@modern-js/plugin-module-federation",
|
|
47
|
+
setup: async (api) => {
|
|
48
|
+
const modernjsConfig = api.getConfig();
|
|
49
|
+
api.modifyBundlerChain((chain) => {
|
|
50
|
+
const bundlerType = api.getAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
|
|
51
|
+
const browserPluginOptions = internalModernPluginOptions.csrConfig;
|
|
52
|
+
const MFPlugin = bundlerType === "webpack" ? import_enhanced.ModuleFederationPlugin : import_rspack.ModuleFederationPlugin;
|
|
53
|
+
if ((0, import_utils.isWebTarget)(chain.get("target"))) {
|
|
54
|
+
chain.plugin("plugin-module-federation").use(MFPlugin, [
|
|
55
|
+
browserPluginOptions
|
|
56
|
+
]).init((Plugin, args) => {
|
|
57
|
+
internalModernPluginOptions.browserPlugin = new Plugin(args[0]);
|
|
58
|
+
return internalModernPluginOptions.browserPlugin;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (bundlerType === "webpack") {
|
|
62
|
+
var _modernjsConfig_source;
|
|
63
|
+
const enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry;
|
|
64
|
+
if (!enableAsyncEntry && browserPluginOptions.async !== false) {
|
|
65
|
+
const asyncBoundaryPluginOptions = typeof browserPluginOptions.async === "object" ? browserPluginOptions.async : {
|
|
66
|
+
eager: (module2) => module2 && /\.federation/.test((module2 === null || module2 === void 0 ? void 0 : module2.request) || ""),
|
|
67
|
+
excludeChunk: (chunk) => chunk.name === browserPluginOptions.name
|
|
68
|
+
};
|
|
69
|
+
chain.plugin("async-boundary-plugin").use(import_enhanced.AsyncBoundaryPlugin, [
|
|
70
|
+
asyncBoundaryPluginOptions
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
api._internalServerPlugins(({ plugins }) => {
|
|
76
|
+
plugins.push({
|
|
77
|
+
name: "@module-federation/modern-js/server"
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
plugins
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
usePlugins: [
|
|
85
|
+
(0, import_configPlugin.moduleFederationConfigPlugin)(internalModernPluginOptions),
|
|
86
|
+
(0, import_ssrPlugin.moduleFederationSSRPlugin)(internalModernPluginOptions)
|
|
87
|
+
]
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
var cli_default = moduleFederationPlugin;
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
createModuleFederationConfig,
|
|
94
|
+
moduleFederationPlugin
|
|
95
|
+
});
|