@module-federation/modern-js 0.11.3 → 0.12.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/cjs/cli/configPlugin.js +258 -11
- package/dist/cjs/cli/{utils.spec.js → configPlugin.spec.js} +3 -2
- package/dist/cjs/cli/index.js +1 -1
- package/dist/cjs/cli/manifest.js +13 -9
- package/dist/cjs/cli/ssrPlugin.js +58 -10
- package/dist/cjs/cli/utils.js +0 -235
- package/dist/cjs/constant.js +0 -3
- package/dist/esm/cli/configPlugin.js +278 -8
- package/dist/esm/cli/{utils.spec.js → configPlugin.spec.js} +2 -1
- package/dist/esm/cli/index.js +1 -1
- package/dist/esm/cli/manifest.js +13 -9
- package/dist/esm/cli/ssrPlugin.js +61 -11
- package/dist/esm/cli/utils.js +0 -260
- package/dist/esm/constant.js +0 -2
- package/dist/esm-node/cli/configPlugin.js +251 -8
- package/dist/esm-node/cli/{utils.spec.js → configPlugin.spec.js} +2 -1
- package/dist/esm-node/cli/index.js +1 -1
- package/dist/esm-node/cli/manifest.js +13 -9
- package/dist/esm-node/cli/ssrPlugin.js +58 -10
- package/dist/esm-node/cli/utils.js +0 -231
- package/dist/esm-node/constant.js +0 -2
- package/dist/types/cli/configPlugin.d.ts +16 -2
- package/dist/types/cli/manifest.d.ts +1 -1
- package/dist/types/cli/utils.d.ts +1 -14
- package/dist/types/constant.d.ts +0 -1
- package/dist/types/types/index.d.ts +3 -1
- package/package.json +8 -7
- /package/dist/types/cli/{utils.spec.d.ts → configPlugin.spec.d.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
+
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
2
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
4
|
import path from "path";
|
|
4
5
|
import { fs } from "@modern-js/utils";
|
|
@@ -7,7 +8,6 @@ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-
|
|
|
7
8
|
import UniverseEntryChunkTrackerPlugin from "@module-federation/node/universe-entry-chunk-tracker-plugin";
|
|
8
9
|
import { updateStatsAndManifest } from "./manifest";
|
|
9
10
|
import { isDev } from "./constant";
|
|
10
|
-
import { MODERN_JS_SERVER_DIR } from "../constant";
|
|
11
11
|
import logger from "./logger";
|
|
12
12
|
import { isWebTarget, skipByTarget } from "./utils";
|
|
13
13
|
function setEnv() {
|
|
@@ -15,6 +15,55 @@ function setEnv() {
|
|
|
15
15
|
process.env["MF_SSR_PRJ"] = "true";
|
|
16
16
|
}
|
|
17
17
|
var CHAIN_MF_PLUGIN_ID = "plugin-module-federation-server";
|
|
18
|
+
var mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
19
|
+
return {
|
|
20
|
+
name: "@modern-js/plugin-mf-post-config",
|
|
21
|
+
pre: [
|
|
22
|
+
"@modern-js/builder-plugin-ssr"
|
|
23
|
+
],
|
|
24
|
+
setup: function setup(api) {
|
|
25
|
+
if (pluginOptions.csrConfig.getPublicPath) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var csrOutputPath = "";
|
|
29
|
+
var ssrOutputPath = "";
|
|
30
|
+
var ssrEnv = "";
|
|
31
|
+
api.modifyEnvironmentConfig(function(config, param) {
|
|
32
|
+
var name = param.name;
|
|
33
|
+
var target = config.output.target;
|
|
34
|
+
if (skipByTarget(target)) {
|
|
35
|
+
return config;
|
|
36
|
+
}
|
|
37
|
+
if (isWebTarget(target)) {
|
|
38
|
+
csrOutputPath = config.output.distPath.root;
|
|
39
|
+
} else {
|
|
40
|
+
ssrOutputPath = config.output.distPath.root;
|
|
41
|
+
ssrEnv = name;
|
|
42
|
+
}
|
|
43
|
+
return config;
|
|
44
|
+
});
|
|
45
|
+
var modifySSRPublicPath = function(config, utils) {
|
|
46
|
+
if (ssrEnv !== utils.environment.name) {
|
|
47
|
+
return config;
|
|
48
|
+
}
|
|
49
|
+
var userSSRConfig = pluginOptions.userConfig.ssr ? _type_of(pluginOptions.userConfig.ssr) === "object" ? pluginOptions.userConfig.ssr : {} : {};
|
|
50
|
+
if (userSSRConfig.distOutputDir) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
config.output.publicPath = "".concat(config.output.publicPath).concat(path.relative(csrOutputPath, ssrOutputPath), "/");
|
|
54
|
+
return config;
|
|
55
|
+
};
|
|
56
|
+
api.modifyWebpackConfig(function(config, utils) {
|
|
57
|
+
modifySSRPublicPath(config, utils);
|
|
58
|
+
return config;
|
|
59
|
+
});
|
|
60
|
+
api.modifyRspackConfig(function(config, utils) {
|
|
61
|
+
modifySSRPublicPath(config, utils);
|
|
62
|
+
return config;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
18
67
|
var moduleFederationSSRPlugin = function(pluginOptions) {
|
|
19
68
|
return {
|
|
20
69
|
name: "@modern-js/plugin-module-federation-ssr",
|
|
@@ -24,12 +73,10 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
|
|
|
24
73
|
],
|
|
25
74
|
setup: function() {
|
|
26
75
|
var _ref = _async_to_generator(function(api) {
|
|
27
|
-
var _pluginOptions_userConfig, _modernjsConfig_server, modernjsConfig, _pluginOptions_userConfig_ssr, enableSSR
|
|
76
|
+
var _pluginOptions_userConfig, _modernjsConfig_server, modernjsConfig, _pluginOptions_userConfig_ssr, enableSSR;
|
|
28
77
|
return _ts_generator(this, function(_state) {
|
|
29
78
|
modernjsConfig = api.getConfig();
|
|
30
79
|
enableSSR = (_pluginOptions_userConfig_ssr = (_pluginOptions_userConfig = pluginOptions.userConfig) === null || _pluginOptions_userConfig === void 0 ? void 0 : _pluginOptions_userConfig.ssr) !== null && _pluginOptions_userConfig_ssr !== void 0 ? _pluginOptions_userConfig_ssr : Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
|
|
31
|
-
csrOutputPath = "";
|
|
32
|
-
ssrOutputPath = "";
|
|
33
80
|
if (!enableSSR) {
|
|
34
81
|
return [
|
|
35
82
|
2
|
|
@@ -77,20 +124,23 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
|
|
|
77
124
|
if (isDev) {
|
|
78
125
|
chain.plugin("UniverseEntryChunkTrackerPlugin").use(UniverseEntryChunkTrackerPlugin);
|
|
79
126
|
}
|
|
127
|
+
var userSSRConfig = pluginOptions.userConfig.ssr ? _type_of(pluginOptions.userConfig.ssr) === "object" ? pluginOptions.userConfig.ssr : {} : {};
|
|
128
|
+
var publicPath = chain.output.get("publicPath");
|
|
129
|
+
if (userSSRConfig.distOutputDir && publicPath) {
|
|
130
|
+
chain.output.publicPath("".concat(publicPath).concat(userSSRConfig.distOutputDir, "/"));
|
|
131
|
+
}
|
|
80
132
|
}
|
|
81
133
|
if (isDev && isWeb) {
|
|
82
134
|
chain.externals({
|
|
83
135
|
"@module-federation/node/utils": "NOT_USED_IN_BROWSER"
|
|
84
136
|
});
|
|
85
137
|
}
|
|
86
|
-
if (!isWeb) {
|
|
87
|
-
ssrOutputPath = chain.output.get("path") || path.resolve(process.cwd(), "dist/".concat(MODERN_JS_SERVER_DIR));
|
|
88
|
-
} else {
|
|
89
|
-
csrOutputPath = chain.output.get("path") || path.resolve(process.cwd(), "dist");
|
|
90
|
-
}
|
|
91
138
|
});
|
|
92
139
|
api.config(function() {
|
|
93
140
|
return {
|
|
141
|
+
builderPlugins: [
|
|
142
|
+
mfSSRRsbuildPlugin(pluginOptions)
|
|
143
|
+
],
|
|
94
144
|
tools: {
|
|
95
145
|
devServer: {
|
|
96
146
|
before: [
|
|
@@ -123,11 +173,11 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
|
|
|
123
173
|
});
|
|
124
174
|
api.onAfterBuild(function() {
|
|
125
175
|
var nodePlugin = pluginOptions.nodePlugin, browserPlugin = pluginOptions.browserPlugin, distOutputDir = pluginOptions.distOutputDir;
|
|
126
|
-
updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir
|
|
176
|
+
updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir);
|
|
127
177
|
});
|
|
128
178
|
api.onDevCompileDone(function() {
|
|
129
179
|
var nodePlugin = pluginOptions.nodePlugin, browserPlugin = pluginOptions.browserPlugin, distOutputDir = pluginOptions.distOutputDir;
|
|
130
|
-
updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir
|
|
180
|
+
updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir);
|
|
131
181
|
});
|
|
132
182
|
return [
|
|
133
183
|
2
|
package/dist/esm/cli/utils.js
CHANGED
|
@@ -1,260 +1,4 @@
|
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
-
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
|
-
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
|
-
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
5
|
-
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
6
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
1
|
import os from "os";
|
|
8
|
-
import path from "path";
|
|
9
|
-
import { encodeName } from "@module-federation/sdk";
|
|
10
|
-
import { bundle } from "@modern-js/node-bundle-require";
|
|
11
|
-
import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
|
|
12
|
-
import logger from "./logger";
|
|
13
|
-
import { autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
|
|
14
|
-
var defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
|
|
15
|
-
var isDev = process.env.NODE_ENV === "development";
|
|
16
|
-
var getMFConfig = function() {
|
|
17
|
-
var _ref = _async_to_generator(function(userConfig) {
|
|
18
|
-
var config, configPath, mfConfigPath, preBundlePath, mfConfig;
|
|
19
|
-
return _ts_generator(this, function(_state) {
|
|
20
|
-
switch (_state.label) {
|
|
21
|
-
case 0:
|
|
22
|
-
config = userConfig.config, configPath = userConfig.configPath;
|
|
23
|
-
if (config) {
|
|
24
|
-
return [
|
|
25
|
-
2,
|
|
26
|
-
config
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
mfConfigPath = configPath ? configPath : defaultPath;
|
|
30
|
-
return [
|
|
31
|
-
4,
|
|
32
|
-
bundle(mfConfigPath)
|
|
33
|
-
];
|
|
34
|
-
case 1:
|
|
35
|
-
preBundlePath = _state.sent();
|
|
36
|
-
return [
|
|
37
|
-
4,
|
|
38
|
-
import(preBundlePath)
|
|
39
|
-
];
|
|
40
|
-
case 2:
|
|
41
|
-
mfConfig = _state.sent().default;
|
|
42
|
-
return [
|
|
43
|
-
2,
|
|
44
|
-
mfConfig
|
|
45
|
-
];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
return function getMFConfig2(userConfig) {
|
|
50
|
-
return _ref.apply(this, arguments);
|
|
51
|
-
};
|
|
52
|
-
}();
|
|
53
|
-
var injectRuntimePlugins = function(runtimePlugin, runtimePlugins) {
|
|
54
|
-
if (!runtimePlugins.includes(runtimePlugin)) {
|
|
55
|
-
runtimePlugins.push(runtimePlugin);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var replaceRemoteUrl = function(mfConfig, remoteIpStrategy) {
|
|
59
|
-
if (remoteIpStrategy && remoteIpStrategy === "inherit") {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (!mfConfig.remotes) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
var ipv4 = getIPV4();
|
|
66
|
-
var handleRemoteObject = function(remoteObject) {
|
|
67
|
-
Object.keys(remoteObject).forEach(function(remoteKey) {
|
|
68
|
-
var remote = remoteObject[remoteKey];
|
|
69
|
-
if (Array.isArray(remote)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (typeof remote === "string" && remote.includes(LOCALHOST)) {
|
|
73
|
-
remoteObject[remoteKey] = remote.replace(LOCALHOST, ipv4);
|
|
74
|
-
}
|
|
75
|
-
if ((typeof remote === "undefined" ? "undefined" : _type_of(remote)) === "object" && !Array.isArray(remote.external) && remote.external.includes(LOCALHOST)) {
|
|
76
|
-
remote.external = remote.external.replace(LOCALHOST, ipv4);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
if (Array.isArray(mfConfig.remotes)) {
|
|
81
|
-
mfConfig.remotes.forEach(function(remoteObject) {
|
|
82
|
-
if (typeof remoteObject === "string") {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
handleRemoteObject(remoteObject);
|
|
86
|
-
});
|
|
87
|
-
} else if (typeof mfConfig.remotes !== "string") {
|
|
88
|
-
handleRemoteObject(mfConfig.remotes);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
var patchDTSConfig = function(mfConfig, isServer) {
|
|
92
|
-
if (isServer) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
var ModernJSRuntime = "@modern-js/runtime/mf";
|
|
96
|
-
if (mfConfig.dts !== false) {
|
|
97
|
-
var _mfConfig_dts, _mfConfig_dts1;
|
|
98
|
-
if (typeof mfConfig.dts === "boolean" || mfConfig.dts === void 0) {
|
|
99
|
-
mfConfig.dts = {
|
|
100
|
-
consumeTypes: {
|
|
101
|
-
runtimePkgs: [
|
|
102
|
-
ModernJSRuntime
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
} 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) {
|
|
107
|
-
var _mfConfig_dts2;
|
|
108
|
-
if (typeof mfConfig.dts.consumeTypes === "boolean" || ((_mfConfig_dts2 = mfConfig.dts) === null || _mfConfig_dts2 === void 0 ? void 0 : _mfConfig_dts2.consumeTypes) === void 0) {
|
|
109
|
-
mfConfig.dts.consumeTypes = {
|
|
110
|
-
runtimePkgs: [
|
|
111
|
-
ModernJSRuntime
|
|
112
|
-
]
|
|
113
|
-
};
|
|
114
|
-
} else {
|
|
115
|
-
mfConfig.dts.consumeTypes.runtimePkgs = mfConfig.dts.consumeTypes.runtimePkgs || [];
|
|
116
|
-
if (!mfConfig.dts.consumeTypes.runtimePkgs.includes(ModernJSRuntime)) {
|
|
117
|
-
mfConfig.dts.consumeTypes.runtimePkgs.push(ModernJSRuntime);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy) {
|
|
124
|
-
replaceRemoteUrl(mfConfig, remoteIpStrategy);
|
|
125
|
-
if (mfConfig.remoteType === void 0) {
|
|
126
|
-
mfConfig.remoteType = "script";
|
|
127
|
-
}
|
|
128
|
-
if (!mfConfig.name) {
|
|
129
|
-
throw new Error("".concat(PLUGIN_IDENTIFIER, " mfConfig.name can not be empty!"));
|
|
130
|
-
}
|
|
131
|
-
var runtimePlugins = _to_consumable_array(mfConfig.runtimePlugins || []);
|
|
132
|
-
patchDTSConfig(mfConfig, isServer);
|
|
133
|
-
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
134
|
-
if (isDev) {
|
|
135
|
-
injectRuntimePlugins(require.resolve("@module-federation/modern-js/resolve-entry-ipv4"), runtimePlugins);
|
|
136
|
-
}
|
|
137
|
-
if (isServer) {
|
|
138
|
-
injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
|
|
139
|
-
if (isDev) {
|
|
140
|
-
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
141
|
-
}
|
|
142
|
-
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
143
|
-
if (!mfConfig.library) {
|
|
144
|
-
mfConfig.library = {
|
|
145
|
-
type: "commonjs-module",
|
|
146
|
-
name: mfConfig.name
|
|
147
|
-
};
|
|
148
|
-
} else {
|
|
149
|
-
if (!mfConfig.library.type) {
|
|
150
|
-
mfConfig.library.type = "commonjs-module";
|
|
151
|
-
}
|
|
152
|
-
if (!mfConfig.library.name) {
|
|
153
|
-
mfConfig.library.name = mfConfig.name;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
mfConfig.runtimePlugins = runtimePlugins;
|
|
158
|
-
if (!isServer) {
|
|
159
|
-
var _mfConfig_library;
|
|
160
|
-
if (((_mfConfig_library = mfConfig.library) === null || _mfConfig_library === void 0 ? void 0 : _mfConfig_library.type) === "commonjs-module") {
|
|
161
|
-
mfConfig.library.type = "global";
|
|
162
|
-
}
|
|
163
|
-
return mfConfig;
|
|
164
|
-
}
|
|
165
|
-
mfConfig.dts = false;
|
|
166
|
-
mfConfig.dev = false;
|
|
167
|
-
return mfConfig;
|
|
168
|
-
};
|
|
169
|
-
function patchIgnoreWarning(chain) {
|
|
170
|
-
var ignoreWarnings = chain.get("ignoreWarnings") || [];
|
|
171
|
-
var ignoredMsgs = [
|
|
172
|
-
"external script",
|
|
173
|
-
"process.env.WS_NO_BUFFER_UTIL",
|
|
174
|
-
"Can't resolve 'utf-8-validate"
|
|
175
|
-
];
|
|
176
|
-
ignoreWarnings.push(function(warning) {
|
|
177
|
-
if (ignoredMsgs.some(function(msg) {
|
|
178
|
-
return warning.message.includes(msg);
|
|
179
|
-
})) {
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
return false;
|
|
183
|
-
});
|
|
184
|
-
chain.ignoreWarnings(ignoreWarnings);
|
|
185
|
-
}
|
|
186
|
-
function addMyTypes2Ignored(chain, mfConfig) {
|
|
187
|
-
var watchOptions = chain.get("watchOptions");
|
|
188
|
-
if (!watchOptions || !watchOptions.ignored) {
|
|
189
|
-
chain.watchOptions({
|
|
190
|
-
ignored: /[\\/](?:\.git|node_modules|@mf-types)[\\/]/
|
|
191
|
-
});
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
var ignored = watchOptions.ignored;
|
|
195
|
-
var DEFAULT_IGNORED_GLOB = "**/@mf-types/**";
|
|
196
|
-
if (Array.isArray(ignored)) {
|
|
197
|
-
if (mfConfig.dts !== false && _type_of(mfConfig.dts) === "object" && _type_of(mfConfig.dts.consumeTypes) === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
|
|
198
|
-
chain.watchOptions(_object_spread_props(_object_spread({}, watchOptions), {
|
|
199
|
-
ignored: ignored.concat("**/".concat(mfConfig.dts.consumeTypes.remoteTypesFolder, "/**"))
|
|
200
|
-
}));
|
|
201
|
-
} else {
|
|
202
|
-
chain.watchOptions(_object_spread_props(_object_spread({}, watchOptions), {
|
|
203
|
-
ignored: ignored.concat(DEFAULT_IGNORED_GLOB)
|
|
204
|
-
}));
|
|
205
|
-
}
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
if (typeof ignored !== "string") {
|
|
209
|
-
chain.watchOptions(_object_spread_props(_object_spread({}, watchOptions), {
|
|
210
|
-
ignored: /[\\/](?:\.git|node_modules|@mf-types)[\\/]/
|
|
211
|
-
}));
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
chain.watchOptions(_object_spread_props(_object_spread({}, watchOptions), {
|
|
215
|
-
ignored: ignored.concat(DEFAULT_IGNORED_GLOB)
|
|
216
|
-
}));
|
|
217
|
-
}
|
|
218
|
-
function patchBundlerConfig(options) {
|
|
219
|
-
var _modernjsConfig_deploy;
|
|
220
|
-
var chain = options.chain, modernjsConfig = options.modernjsConfig, isServer = options.isServer, mfConfig = options.mfConfig, enableSSR = options.enableSSR;
|
|
221
|
-
chain.optimization.delete("runtimeChunk");
|
|
222
|
-
patchIgnoreWarning(chain);
|
|
223
|
-
if (!chain.output.get("chunkLoadingGlobal")) {
|
|
224
|
-
chain.output.chunkLoadingGlobal("chunk_".concat(mfConfig.name));
|
|
225
|
-
}
|
|
226
|
-
if (!chain.output.get("uniqueName")) {
|
|
227
|
-
chain.output.uniqueName(mfConfig.name);
|
|
228
|
-
}
|
|
229
|
-
var splitChunkConfig = chain.optimization.splitChunks.entries();
|
|
230
|
-
if (!isServer) {
|
|
231
|
-
autoDeleteSplitChunkCacheGroups(mfConfig, splitChunkConfig);
|
|
232
|
-
}
|
|
233
|
-
if (!isServer && enableSSR && splitChunkConfig && (typeof splitChunkConfig === "undefined" ? "undefined" : _type_of(splitChunkConfig)) === "object" && splitChunkConfig.cacheGroups) {
|
|
234
|
-
splitChunkConfig.chunks = "async";
|
|
235
|
-
logger.warn('splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"');
|
|
236
|
-
}
|
|
237
|
-
if (isDev && chain.output.get("publicPath") === "auto") {
|
|
238
|
-
var _modernjsConfig_dev, _modernjsConfig_server;
|
|
239
|
-
var 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;
|
|
240
|
-
var publicPath = "http://localhost:".concat(port, "/");
|
|
241
|
-
chain.output.publicPath(publicPath);
|
|
242
|
-
}
|
|
243
|
-
if (isServer && enableSSR) {
|
|
244
|
-
var uniqueName = mfConfig.name || chain.output.get("uniqueName");
|
|
245
|
-
var chunkFileName = chain.output.get("chunkFilename");
|
|
246
|
-
if (typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
247
|
-
var suffix = "".concat(encodeName(uniqueName), "-[chunkhash].js");
|
|
248
|
-
chain.output.chunkFilename(chunkFileName.replace(".js", suffix));
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
if (isDev && enableSSR && !isServer) {
|
|
252
|
-
chain.resolve.fallback.set("crypto", false).set("stream", false).set("vm", false);
|
|
253
|
-
}
|
|
254
|
-
if (((_modernjsConfig_deploy = modernjsConfig.deploy) === null || _modernjsConfig_deploy === void 0 ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length) {
|
|
255
|
-
chain.optimization.usedExports(false);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
2
|
var localIpv4 = "127.0.0.1";
|
|
259
3
|
var getIpv4Interfaces = function() {
|
|
260
4
|
try {
|
|
@@ -299,11 +43,7 @@ var skipByTarget = function(target) {
|
|
|
299
43
|
return false;
|
|
300
44
|
};
|
|
301
45
|
export {
|
|
302
|
-
addMyTypes2Ignored,
|
|
303
46
|
getIPV4,
|
|
304
|
-
getMFConfig,
|
|
305
47
|
isWebTarget,
|
|
306
|
-
patchBundlerConfig,
|
|
307
|
-
patchMFConfig,
|
|
308
48
|
skipByTarget
|
|
309
49
|
};
|