@module-federation/modern-js 0.0.0-next-20241224161508 → 0.0.0-next-20241224163615
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/utils.js +20 -2
- package/dist/esm/cli/utils.js +36 -1
- package/dist/esm-node/cli/utils.js +19 -1
- package/package.json +5 -6
package/dist/cjs/cli/utils.js
CHANGED
|
@@ -42,7 +42,6 @@ var import_sdk = require("@module-federation/sdk");
|
|
|
42
42
|
var import_node_bundle_require = require("@modern-js/node-bundle-require");
|
|
43
43
|
var import_constant = require("../constant");
|
|
44
44
|
var import_logger = __toESM(require("./logger"));
|
|
45
|
-
var import_utils = require("@module-federation/rsbuild-plugin/utils");
|
|
46
45
|
const defaultPath = import_path.default.resolve(process.cwd(), "module-federation.config.ts");
|
|
47
46
|
const isDev = process.env.NODE_ENV === "development";
|
|
48
47
|
const getMFConfig = async (userConfig) => {
|
|
@@ -239,7 +238,7 @@ function patchBundlerConfig(options) {
|
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
if (!isServer) {
|
|
242
|
-
|
|
241
|
+
autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig);
|
|
243
242
|
}
|
|
244
243
|
if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
245
244
|
bundlerConfig.optimization.splitChunks.chunks = "async";
|
|
@@ -322,6 +321,25 @@ const SHARED_SPLIT_CHUNK_MAP = {
|
|
|
322
321
|
"@douyinfe/semi-ui": SPLIT_CHUNK_MAP.SEMI,
|
|
323
322
|
axios: SPLIT_CHUNK_MAP.AXIOS
|
|
324
323
|
};
|
|
324
|
+
function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
|
|
325
|
+
var _bundlerConfig_optimization;
|
|
326
|
+
if (!mfConfig.shared) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (!((_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks) || !bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
|
|
333
|
+
for (const shared of arrayShared) {
|
|
334
|
+
const splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
|
|
335
|
+
if (!splitChunkKey) {
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
if (bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey]) {
|
|
339
|
+
delete bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
325
343
|
// Annotate the CommonJS export names for ESM import in node:
|
|
326
344
|
0 && (module.exports = {
|
|
327
345
|
addMyTypes2Ignored,
|
package/dist/esm/cli/utils.js
CHANGED
|
@@ -10,7 +10,6 @@ import { encodeName } from "@module-federation/sdk";
|
|
|
10
10
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
11
11
|
import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
|
|
12
12
|
import logger from "./logger";
|
|
13
|
-
import { autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
|
|
14
13
|
var defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
|
|
15
14
|
var isDev = process.env.NODE_ENV === "development";
|
|
16
15
|
var getMFConfig = function() {
|
|
@@ -312,6 +311,42 @@ var SHARED_SPLIT_CHUNK_MAP = {
|
|
|
312
311
|
"@douyinfe/semi-ui": SPLIT_CHUNK_MAP.SEMI,
|
|
313
312
|
axios: SPLIT_CHUNK_MAP.AXIOS
|
|
314
313
|
};
|
|
314
|
+
function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
|
|
315
|
+
var _bundlerConfig_optimization;
|
|
316
|
+
if (!mfConfig.shared) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (!((_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks) || !bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
var arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
|
|
323
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
324
|
+
try {
|
|
325
|
+
for (var _iterator = arrayShared[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
326
|
+
var shared = _step.value;
|
|
327
|
+
var splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
|
|
328
|
+
if (!splitChunkKey) {
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
if (bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey]) {
|
|
332
|
+
delete bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey];
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
} catch (err) {
|
|
336
|
+
_didIteratorError = true;
|
|
337
|
+
_iteratorError = err;
|
|
338
|
+
} finally {
|
|
339
|
+
try {
|
|
340
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
341
|
+
_iterator.return();
|
|
342
|
+
}
|
|
343
|
+
} finally {
|
|
344
|
+
if (_didIteratorError) {
|
|
345
|
+
throw _iteratorError;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
315
350
|
export {
|
|
316
351
|
addMyTypes2Ignored,
|
|
317
352
|
getIPV4,
|
|
@@ -4,7 +4,6 @@ import { encodeName } from "@module-federation/sdk";
|
|
|
4
4
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
5
5
|
import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
|
|
6
6
|
import logger from "./logger";
|
|
7
|
-
import { autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
|
|
8
7
|
const defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
|
|
9
8
|
const isDev = process.env.NODE_ENV === "development";
|
|
10
9
|
const getMFConfig = async (userConfig) => {
|
|
@@ -284,6 +283,25 @@ const SHARED_SPLIT_CHUNK_MAP = {
|
|
|
284
283
|
"@douyinfe/semi-ui": SPLIT_CHUNK_MAP.SEMI,
|
|
285
284
|
axios: SPLIT_CHUNK_MAP.AXIOS
|
|
286
285
|
};
|
|
286
|
+
function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
|
|
287
|
+
var _bundlerConfig_optimization;
|
|
288
|
+
if (!mfConfig.shared) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (!((_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks) || !bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
|
|
295
|
+
for (const shared of arrayShared) {
|
|
296
|
+
const splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
|
|
297
|
+
if (!splitChunkKey) {
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey]) {
|
|
301
|
+
delete bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey];
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
287
305
|
export {
|
|
288
306
|
addMyTypes2Ignored,
|
|
289
307
|
getIPV4,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20241224163615",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -90,10 +90,9 @@
|
|
|
90
90
|
"hoist-non-react-statics": "3.3.2",
|
|
91
91
|
"node-fetch": "~3.3.0",
|
|
92
92
|
"react-error-boundary": "4.1.2",
|
|
93
|
-
"@module-federation/
|
|
94
|
-
"@module-federation/
|
|
95
|
-
"@module-federation/
|
|
96
|
-
"@module-federation/sdk": "0.0.0-next-20241224161508"
|
|
93
|
+
"@module-federation/enhanced": "0.0.0-next-20241224163615",
|
|
94
|
+
"@module-federation/node": "0.0.0-next-20241224163615",
|
|
95
|
+
"@module-federation/sdk": "0.0.0-next-20241224163615"
|
|
97
96
|
},
|
|
98
97
|
"devDependencies": {
|
|
99
98
|
"@modern-js/app-tools": "2.60.6",
|
|
@@ -102,7 +101,7 @@
|
|
|
102
101
|
"@modern-js/runtime": "2.60.6",
|
|
103
102
|
"@modern-js/tsconfig": "2.60.6",
|
|
104
103
|
"@types/hoist-non-react-statics": "3.3.5",
|
|
105
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
104
|
+
"@module-federation/manifest": "0.0.0-next-20241224163615"
|
|
106
105
|
},
|
|
107
106
|
"peerDependencies": {
|
|
108
107
|
"react": ">=17",
|