@module-federation/modern-js 0.0.0-next-20240909062831 → 0.0.0-next-20240909083238
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/dataLoader/ast/constant.js +49 -0
- package/dist/cjs/cli/dataLoader/ast/generateRoutes.js +142 -0
- package/dist/cjs/cli/dataLoader/ast/generateSelfRoutes.js +48 -0
- package/dist/cjs/cli/dataLoader/ast/generateSerializableRoutes.js +90 -0
- package/dist/cjs/cli/dataLoader/ast/generateSlimRoutes.js +104 -0
- package/dist/cjs/cli/dataLoader/ast/index.js +37 -0
- package/dist/cjs/cli/dataLoader/generateRouteFile.js +143 -0
- package/dist/cjs/cli/dataLoader/patchMFConfig.js +137 -0
- package/dist/cjs/cli/dataLoader/plugin.js +205 -0
- package/dist/cjs/cli/index.js +6 -1
- package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +7 -10
- package/dist/cjs/cli/mfRuntimePlugins/node.js +44 -0
- package/dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js +40 -38
- package/dist/cjs/cli/server/dataLoaderPlugin.js +82 -0
- package/dist/cjs/cli/server/fetchRemoteFullRoutesMap.js +68 -0
- package/dist/cjs/cli/ssrPlugin.js +1 -1
- package/dist/cjs/cli/utils.js +8 -4
- package/dist/cjs/cli/utils.spec.js +1 -1
- package/dist/cjs/constant.js +32 -2
- package/dist/cjs/interfaces/route.js +16 -0
- package/dist/cjs/runtime/dataLoader/plugin.js +73 -0
- package/dist/cjs/runtime/dataLoader/utils.js +89 -0
- package/dist/cjs/runtime/index.js +4 -1
- package/dist/cjs/runtime/utils.js +38 -0
- package/dist/cjs/{cli/constant.js → runtime/withMFRouteId.js} +9 -6
- package/dist/cjs/ssr-runtime/plugin.js +7 -7
- package/dist/esm/cli/dataLoader/ast/constant.js +18 -0
- package/dist/esm/cli/dataLoader/ast/generateRoutes.js +109 -0
- package/dist/esm/cli/dataLoader/ast/generateSelfRoutes.js +17 -0
- package/dist/esm/cli/dataLoader/ast/generateSerializableRoutes.js +57 -0
- package/dist/esm/cli/dataLoader/ast/generateSlimRoutes.js +73 -0
- package/dist/esm/cli/dataLoader/ast/index.js +10 -0
- package/dist/esm/cli/dataLoader/generateRouteFile.js +293 -0
- package/dist/esm/cli/dataLoader/patchMFConfig.js +103 -0
- package/dist/esm/cli/dataLoader/plugin.js +216 -0
- package/dist/esm/cli/index.js +6 -1
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js +7 -10
- package/dist/esm/cli/mfRuntimePlugins/node.js +16 -0
- package/dist/esm/cli/server/dataLoaderPlugin.js +105 -0
- package/dist/esm/cli/server/fetchRemoteFullRoutesMap.js +86 -0
- package/dist/esm/cli/ssrPlugin.js +1 -1
- package/dist/esm/cli/utils.js +6 -3
- package/dist/esm/cli/utils.spec.js +1 -1
- package/dist/esm/constant.js +21 -1
- package/dist/esm/interfaces/route.js +0 -0
- package/dist/esm/runtime/dataLoader/plugin.js +92 -0
- package/dist/esm/runtime/dataLoader/utils.js +63 -0
- package/dist/esm/runtime/index.js +3 -1
- package/dist/esm/runtime/utils.js +13 -0
- package/dist/esm/runtime/withMFRouteId.js +7 -0
- package/dist/esm/ssr-runtime/plugin.js +7 -10
- package/dist/esm-node/cli/dataLoader/ast/constant.js +18 -0
- package/dist/esm-node/cli/dataLoader/ast/generateRoutes.js +108 -0
- package/dist/esm-node/cli/dataLoader/ast/generateSelfRoutes.js +14 -0
- package/dist/esm-node/cli/dataLoader/ast/generateSerializableRoutes.js +56 -0
- package/dist/esm-node/cli/dataLoader/ast/generateSlimRoutes.js +70 -0
- package/dist/esm-node/cli/dataLoader/ast/index.js +10 -0
- package/dist/esm-node/cli/dataLoader/generateRouteFile.js +108 -0
- package/dist/esm-node/cli/dataLoader/patchMFConfig.js +103 -0
- package/dist/esm-node/cli/dataLoader/plugin.js +169 -0
- package/dist/esm-node/cli/index.js +6 -1
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.js +7 -10
- package/dist/esm-node/cli/mfRuntimePlugins/node.js +14 -0
- package/dist/esm-node/cli/mfRuntimePlugins/resolve-entry-ipv4.js +40 -38
- package/dist/esm-node/cli/server/dataLoaderPlugin.js +62 -0
- package/dist/esm-node/cli/server/fetchRemoteFullRoutesMap.js +43 -0
- package/dist/esm-node/cli/ssrPlugin.js +1 -1
- package/dist/esm-node/cli/utils.js +6 -3
- package/dist/esm-node/cli/utils.spec.js +1 -1
- package/dist/esm-node/constant.js +21 -1
- package/dist/esm-node/interfaces/route.js +0 -0
- package/dist/esm-node/runtime/dataLoader/plugin.js +49 -0
- package/dist/esm-node/runtime/dataLoader/utils.js +63 -0
- package/dist/esm-node/runtime/index.js +3 -1
- package/dist/esm-node/runtime/utils.js +13 -0
- package/dist/esm-node/runtime/withMFRouteId.js +7 -0
- package/dist/esm-node/ssr-runtime/plugin.js +7 -7
- package/dist/types/cli/dataLoader/ast/constant.d.ts +8 -0
- package/dist/types/cli/dataLoader/ast/generateRoutes.d.ts +7 -0
- package/dist/types/cli/dataLoader/ast/generateSelfRoutes.d.ts +7 -0
- package/dist/types/cli/dataLoader/ast/generateSerializableRoutes.d.ts +5 -0
- package/dist/types/cli/dataLoader/ast/generateSlimRoutes.d.ts +7 -0
- package/dist/types/cli/dataLoader/ast/index.d.ts +4 -0
- package/dist/types/cli/dataLoader/generateRouteFile.d.ts +7 -0
- package/dist/types/cli/dataLoader/patchMFConfig.d.ts +11 -0
- package/dist/types/cli/dataLoader/plugin.d.ts +6 -0
- package/dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts +2 -2
- package/dist/types/cli/mfRuntimePlugins/node.d.ts +3 -0
- package/dist/types/cli/server/dataLoaderPlugin.d.ts +10 -0
- package/dist/types/cli/server/fetchRemoteFullRoutesMap.d.ts +10 -0
- package/dist/types/cli/utils.d.ts +2 -0
- package/dist/types/constant.d.ts +10 -0
- package/dist/types/interfaces/route.d.ts +13 -0
- package/dist/types/runtime/dataLoader/plugin.d.ts +2 -0
- package/dist/types/runtime/dataLoader/utils.d.ts +19 -0
- package/dist/types/runtime/index.d.ts +1 -0
- package/dist/types/runtime/utils.d.ts +2 -0
- package/dist/types/runtime/withMFRouteId.d.ts +1 -0
- package/dist/types/types/index.d.ts +10 -0
- package/package.json +40 -11
- package/dist/esm/cli/constant.js +0 -4
- package/dist/esm-node/cli/constant.js +0 -4
- package/dist/types/cli/constant.d.ts +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
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 patchMFConfig_exports = {};
|
|
30
|
+
__export(patchMFConfig_exports, {
|
|
31
|
+
patchMFConfig: () => patchMFConfig
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(patchMFConfig_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_utils = require("@modern-js/utils");
|
|
36
|
+
var import_utils2 = require("../../runtime/utils");
|
|
37
|
+
var import_constant = require("../../constant");
|
|
38
|
+
var import_constant2 = require("../../constant");
|
|
39
|
+
var import_ast = require("./ast");
|
|
40
|
+
function generateExtraExposeFiles(options) {
|
|
41
|
+
const { internalDirectory, mfConfig, isServer, baseName, entries } = options;
|
|
42
|
+
const entryMap = {};
|
|
43
|
+
const outputDir = import_path.default.resolve(process.cwd(), "node_modules/.federation/data-loader");
|
|
44
|
+
import_utils.fs.ensureDirSync(outputDir);
|
|
45
|
+
const addSuffix = (fileName, ext = ".jsx") => {
|
|
46
|
+
if (!isServer) {
|
|
47
|
+
return `${fileName}${ext}`;
|
|
48
|
+
}
|
|
49
|
+
return `${fileName}.server${ext}`;
|
|
50
|
+
};
|
|
51
|
+
const generateEntryRoutes = (entry) => {
|
|
52
|
+
const outputEntryDir = import_path.default.resolve(outputDir, entry);
|
|
53
|
+
import_utils.fs.ensureDirSync(outputEntryDir);
|
|
54
|
+
const sourceDir = import_path.default.resolve(internalDirectory, entry);
|
|
55
|
+
const routesFilePath = import_path.default.resolve(sourceDir, addSuffix(import_constant2.MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME, ".js"));
|
|
56
|
+
const routesFileContent = import_utils.fs.readFileSync(routesFilePath, "utf-8");
|
|
57
|
+
const outputFullRoutesPath = import_path.default.resolve(outputEntryDir, addSuffix(import_constant2.MF_ROUTES));
|
|
58
|
+
(0, import_ast.generateRoutes)({
|
|
59
|
+
sourceCode: routesFileContent,
|
|
60
|
+
filePath: outputFullRoutesPath,
|
|
61
|
+
prefix: (0, import_utils2.transformName2Prefix)(mfConfig.name),
|
|
62
|
+
baseName
|
|
63
|
+
});
|
|
64
|
+
const routeServerLoaderPath = import_path.default.resolve(sourceDir, `${import_constant.MODERN_JS_ROUTE_SERVER_LOADER}.js`);
|
|
65
|
+
const outputRouteServerLoaderPath = import_path.default.resolve(outputEntryDir, `${import_constant.MODERN_JS_ROUTE_SERVER_LOADER}.js`);
|
|
66
|
+
if (isServer) {
|
|
67
|
+
const routeServerLoaderContent = import_utils.fs.readFileSync(routeServerLoaderPath, "utf-8");
|
|
68
|
+
(0, import_ast.generateRoutes)({
|
|
69
|
+
sourceCode: routeServerLoaderContent,
|
|
70
|
+
filePath: outputRouteServerLoaderPath,
|
|
71
|
+
prefix: (0, import_utils2.transformName2Prefix)(mfConfig.name),
|
|
72
|
+
baseName
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
entryMap[entry] = {
|
|
76
|
+
routesPath: outputFullRoutesPath,
|
|
77
|
+
routeServerLoaderPath: outputRouteServerLoaderPath
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
entries.forEach((entry) => {
|
|
81
|
+
generateEntryRoutes(entry);
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
entryMap
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function addExpose(options) {
|
|
88
|
+
const { mfConfig, isServer } = options;
|
|
89
|
+
if (mfConfig.remotes && mfConfig.exposes) {
|
|
90
|
+
throw new Error(`dataLoader only support for pure provider/consumer !`);
|
|
91
|
+
}
|
|
92
|
+
const { entryMap } = generateExtraExposeFiles(options);
|
|
93
|
+
const addExposeByEntry = (entry, routesPath, routeServerLoaderPath) => {
|
|
94
|
+
if (!mfConfig.exposes) {
|
|
95
|
+
mfConfig.exposes = {};
|
|
96
|
+
}
|
|
97
|
+
const routesKey = `./${entry}/${import_constant2.MF_ROUTES}`;
|
|
98
|
+
if (!mfConfig.exposes[routesKey]) {
|
|
99
|
+
mfConfig.exposes[routesKey] = routesPath;
|
|
100
|
+
}
|
|
101
|
+
const routeServerLoaderKey = `./${entry}/${import_constant.MODERN_JS_ROUTE_SERVER_LOADER}`;
|
|
102
|
+
if (isServer && !mfConfig.exposes[routeServerLoaderKey]) {
|
|
103
|
+
mfConfig.exposes[routeServerLoaderKey] = routeServerLoaderPath;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
Object.keys(entryMap).forEach((entry) => {
|
|
107
|
+
const { routesPath, routeServerLoaderPath } = entryMap[entry];
|
|
108
|
+
addExposeByEntry(entry, routesPath, routeServerLoaderPath);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function addShared(options) {
|
|
112
|
+
const { metaName, mfConfig } = options;
|
|
113
|
+
const alias = `@${metaName}/runtime/router`;
|
|
114
|
+
if (!mfConfig.shared) {
|
|
115
|
+
mfConfig.shared = {
|
|
116
|
+
[alias]: {
|
|
117
|
+
singleton: true
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
} else {
|
|
121
|
+
if (!Array.isArray(mfConfig.shared)) {
|
|
122
|
+
mfConfig.shared[alias] = {
|
|
123
|
+
singleton: true
|
|
124
|
+
};
|
|
125
|
+
} else {
|
|
126
|
+
mfConfig.shared.push(alias);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function patchMFConfig(options) {
|
|
131
|
+
addShared(options);
|
|
132
|
+
addExpose(options);
|
|
133
|
+
}
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
patchMFConfig
|
|
137
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
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 plugin_exports = {};
|
|
30
|
+
__export(plugin_exports, {
|
|
31
|
+
default: () => plugin_default,
|
|
32
|
+
generateRoutes: () => import_ast.generateRoutes,
|
|
33
|
+
generateSlimRoutes: () => import_ast.generateSlimRoutes,
|
|
34
|
+
moduleFederationDataLoaderPlugin: () => moduleFederationDataLoaderPlugin
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
37
|
+
var import_utils = require("../../runtime/utils");
|
|
38
|
+
var import_constant = require("../../constant");
|
|
39
|
+
var import_constant2 = require("../../constant");
|
|
40
|
+
var import_ast = require("./ast");
|
|
41
|
+
var import_generateRouteFile = require("./generateRouteFile");
|
|
42
|
+
var import_patchMFConfig = require("./patchMFConfig");
|
|
43
|
+
var import_path = __toESM(require("path"));
|
|
44
|
+
function _transformRuntimeOptions(buildOptions) {
|
|
45
|
+
const remotes = buildOptions.remotes || {};
|
|
46
|
+
const runtimeRemotes = Object.entries(remotes).map((remote) => {
|
|
47
|
+
const [alias, nameAndEntry] = remote;
|
|
48
|
+
const [name, entry] = nameAndEntry.split("@");
|
|
49
|
+
return {
|
|
50
|
+
name,
|
|
51
|
+
entry,
|
|
52
|
+
alias
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
name: buildOptions.name,
|
|
57
|
+
remotes: runtimeRemotes
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) => ({
|
|
61
|
+
name: "@modern-js/plugin-module-federation-data-loader",
|
|
62
|
+
pre: [
|
|
63
|
+
"@modern-js/plugin-module-federation-config"
|
|
64
|
+
],
|
|
65
|
+
post: [
|
|
66
|
+
"@modern-js/plugin-router",
|
|
67
|
+
"@modern-js/plugin-module-federation"
|
|
68
|
+
],
|
|
69
|
+
setup: async ({ useConfigContext, useAppContext }) => {
|
|
70
|
+
var _modernjsConfig_server, _modernjsConfig_server1, _modernjsConfig_server2, _modernjsConfig_server3, _modernjsConfig_server4;
|
|
71
|
+
if (!enable) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const {
|
|
75
|
+
baseName,
|
|
76
|
+
partialSSRRemotes = [],
|
|
77
|
+
// patchMFConfig,
|
|
78
|
+
metaName = import_constant2.META_NAME,
|
|
79
|
+
serverPlugin = "@module-federation/modern-js/data-loader-server",
|
|
80
|
+
transformRuntimeOptions
|
|
81
|
+
} = userConfig;
|
|
82
|
+
if (!baseName) {
|
|
83
|
+
throw new Error(`${import_constant.PLUGIN_IDENTIFIER} 'baseName' is required if you enable 'dataLoader'!`);
|
|
84
|
+
}
|
|
85
|
+
const modernjsConfig = useConfigContext();
|
|
86
|
+
const appContext = useAppContext();
|
|
87
|
+
const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
|
|
88
|
+
const name = internalOptions.csrConfig.name;
|
|
89
|
+
const internalDirectory = appContext.internalDirectory.replace(import_constant2.META_NAME, metaName || import_constant2.META_NAME);
|
|
90
|
+
const transformRuntimeFn = transformRuntimeOptions || _transformRuntimeOptions;
|
|
91
|
+
const baseUrls = ((_modernjsConfig_server1 = modernjsConfig.server) === null || _modernjsConfig_server1 === void 0 ? void 0 : _modernjsConfig_server1.baseUrl) ? Array.isArray((_modernjsConfig_server2 = modernjsConfig.server) === null || _modernjsConfig_server2 === void 0 ? void 0 : _modernjsConfig_server2.baseUrl) ? (_modernjsConfig_server3 = modernjsConfig.server) === null || _modernjsConfig_server3 === void 0 ? void 0 : _modernjsConfig_server3.baseUrl : [
|
|
92
|
+
(_modernjsConfig_server4 = modernjsConfig.server) === null || _modernjsConfig_server4 === void 0 ? void 0 : _modernjsConfig_server4.baseUrl
|
|
93
|
+
] : [];
|
|
94
|
+
const entries = /* @__PURE__ */ new Set();
|
|
95
|
+
let remotePathMap = {};
|
|
96
|
+
const ssrByRouteIdsMap = {};
|
|
97
|
+
const serverPluginOptions = {
|
|
98
|
+
runtimeOptions: transformRuntimeFn(internalOptions.csrConfig),
|
|
99
|
+
partialSSRRemotes,
|
|
100
|
+
ssrByRouteIdsMap
|
|
101
|
+
};
|
|
102
|
+
const csrConfig = internalOptions.csrConfig;
|
|
103
|
+
if (typeof csrConfig.remotes === "object" && Object.keys(csrConfig.remotes).length) {
|
|
104
|
+
const { entries: scanEntries, remotePathMap: scanRemotePathMap } = await (0, import_generateRouteFile.generateRouteFile)({
|
|
105
|
+
appDirectory: appContext.appDirectory
|
|
106
|
+
});
|
|
107
|
+
scanEntries.forEach((e) => entries.add(e));
|
|
108
|
+
remotePathMap = scanRemotePathMap;
|
|
109
|
+
} else {
|
|
110
|
+
entries.add(import_constant.DEFAULT_ENTRY);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
_internalRuntimePlugins: ({ entrypoint, plugins }) => {
|
|
114
|
+
plugins.push({
|
|
115
|
+
name: "ssrDataLoader",
|
|
116
|
+
path: "@module-federation/modern-js/data-loader",
|
|
117
|
+
config: {}
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
entrypoint,
|
|
121
|
+
plugins
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
_internalServerPlugins({ plugins }) {
|
|
125
|
+
plugins.push({
|
|
126
|
+
name: serverPlugin,
|
|
127
|
+
options: serverPluginOptions
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
plugins
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
async modifyFileSystemRoutes(options) {
|
|
134
|
+
const { routes, entrypoint } = options;
|
|
135
|
+
const { entryName } = entrypoint;
|
|
136
|
+
const prefix = (0, import_utils.transformName2Prefix)(internalOptions.csrConfig.name);
|
|
137
|
+
const modifyRouteIds = (route, pathName) => {
|
|
138
|
+
const currentPathName = route.path ? import_path.default.join(pathName, route.path) : pathName;
|
|
139
|
+
if (route.id) {
|
|
140
|
+
var _route_children;
|
|
141
|
+
const originalId = route.id;
|
|
142
|
+
route.originalId = originalId;
|
|
143
|
+
const remoteName = remotePathMap[currentPathName];
|
|
144
|
+
if (remoteName) {
|
|
145
|
+
const remoteIdPrefix = (0, import_utils.transformName2Prefix)(remoteName);
|
|
146
|
+
const isLayout = Boolean(route.children);
|
|
147
|
+
const newId = `${remoteIdPrefix}${isLayout ? "layout" : "page"}`;
|
|
148
|
+
ssrByRouteIdsMap[originalId] = newId;
|
|
149
|
+
route.id = newId;
|
|
150
|
+
} else {
|
|
151
|
+
route.id = `${prefix}${route.id}`;
|
|
152
|
+
}
|
|
153
|
+
(_route_children = route.children) === null || _route_children === void 0 ? void 0 : _route_children.forEach((r) => {
|
|
154
|
+
modifyRouteIds(r, currentPathName);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
routes.forEach((route) => {
|
|
159
|
+
modifyRouteIds(route, entryName);
|
|
160
|
+
});
|
|
161
|
+
return options;
|
|
162
|
+
},
|
|
163
|
+
config: async () => {
|
|
164
|
+
return {
|
|
165
|
+
tools: {
|
|
166
|
+
// bundlerChain can not keep target order
|
|
167
|
+
rspack(config, { isServer }) {
|
|
168
|
+
(0, import_patchMFConfig.patchMFConfig)({
|
|
169
|
+
mfConfig: isServer ? internalOptions.ssrConfig : internalOptions.csrConfig,
|
|
170
|
+
baseName,
|
|
171
|
+
metaName,
|
|
172
|
+
isServer,
|
|
173
|
+
internalDirectory,
|
|
174
|
+
entries
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
// bundlerChain can not keep target order
|
|
178
|
+
webpack(config, { isServer }) {
|
|
179
|
+
(0, import_patchMFConfig.patchMFConfig)({
|
|
180
|
+
mfConfig: isServer ? internalOptions.ssrConfig : internalOptions.csrConfig,
|
|
181
|
+
baseName,
|
|
182
|
+
metaName,
|
|
183
|
+
isServer,
|
|
184
|
+
internalDirectory,
|
|
185
|
+
entries
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
source: {
|
|
190
|
+
define: {
|
|
191
|
+
MODERN_ROUTER_ID_PREFIX: JSON.stringify((0, import_utils.transformName2Prefix)(name))
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
var plugin_default = moduleFederationDataLoaderPlugin;
|
|
200
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
201
|
+
0 && (module.exports = {
|
|
202
|
+
generateRoutes,
|
|
203
|
+
generateSlimRoutes,
|
|
204
|
+
moduleFederationDataLoaderPlugin
|
|
205
|
+
});
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -27,6 +27,7 @@ var import_enhanced = require("@module-federation/enhanced");
|
|
|
27
27
|
var import_rspack = require("@module-federation/enhanced/rspack");
|
|
28
28
|
var import_configPlugin = require("./configPlugin");
|
|
29
29
|
var import_ssrPlugin = require("./ssrPlugin");
|
|
30
|
+
var import_plugin = require("./dataLoader/plugin");
|
|
30
31
|
var import_enhanced2 = require("@module-federation/enhanced");
|
|
31
32
|
const moduleFederationPlugin = (userConfig = {}) => {
|
|
32
33
|
const internalModernPluginOptions = {
|
|
@@ -79,7 +80,11 @@ const moduleFederationPlugin = (userConfig = {}) => {
|
|
|
79
80
|
},
|
|
80
81
|
usePlugins: [
|
|
81
82
|
(0, import_configPlugin.moduleFederationConfigPlugin)(internalModernPluginOptions),
|
|
82
|
-
(0, import_ssrPlugin.moduleFederationSSRPlugin)(internalModernPluginOptions)
|
|
83
|
+
(0, import_ssrPlugin.moduleFederationSSRPlugin)(internalModernPluginOptions),
|
|
84
|
+
(0, import_plugin.moduleFederationDataLoaderPlugin)(Boolean(userConfig.dataLoader), internalModernPluginOptions, {
|
|
85
|
+
baseName: "",
|
|
86
|
+
...userConfig.dataLoader
|
|
87
|
+
})
|
|
83
88
|
]
|
|
84
89
|
};
|
|
85
90
|
};
|
|
@@ -31,14 +31,11 @@ __export(inject_node_fetch_exports, {
|
|
|
31
31
|
default: () => inject_node_fetch_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(inject_node_fetch_exports);
|
|
34
|
-
var
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
return args;
|
|
42
|
-
}
|
|
34
|
+
var import_runtimePlugin = __toESM(require("@module-federation/node/runtimePlugin"));
|
|
35
|
+
const isContainer = typeof __filename === "string" ? __filename.includes("remote") ? true : false : false;
|
|
36
|
+
const pluginName = `node-plugin-${isContainer}`;
|
|
37
|
+
const nodePlugin = () => ({
|
|
38
|
+
name: pluginName,
|
|
39
|
+
beforeInit: (0, import_runtimePlugin.default)().beforeInit
|
|
43
40
|
});
|
|
44
|
-
var inject_node_fetch_default =
|
|
41
|
+
var inject_node_fetch_default = nodePlugin;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 node_exports = {};
|
|
30
|
+
__export(node_exports, {
|
|
31
|
+
default: () => node_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(node_exports);
|
|
34
|
+
var import_node_fetch = __toESM(require("node-fetch"));
|
|
35
|
+
const injectNodeFetchPlugin = () => ({
|
|
36
|
+
name: "inject-node-fetch-plugin",
|
|
37
|
+
beforeInit(args) {
|
|
38
|
+
if (!globalThis.fetch) {
|
|
39
|
+
globalThis.fetch = import_node_fetch.default;
|
|
40
|
+
}
|
|
41
|
+
return args;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
var node_default = injectNodeFetchPlugin;
|
|
@@ -39,44 +39,46 @@ function replaceObjectLocalhost(key, obj) {
|
|
|
39
39
|
function replaceLocalhost(url) {
|
|
40
40
|
return url.replace(import_constant.LOCALHOST, ipv4);
|
|
41
41
|
}
|
|
42
|
-
const resolveEntryIpv4Plugin = () =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
const resolveEntryIpv4Plugin = () => {
|
|
43
|
+
return {
|
|
44
|
+
name: "resolve-entry-ipv4",
|
|
45
|
+
beforeRegisterRemote(args) {
|
|
46
|
+
const { remote } = args;
|
|
47
|
+
replaceObjectLocalhost("entry", remote);
|
|
48
|
+
return args;
|
|
49
|
+
},
|
|
50
|
+
async afterResolve(args) {
|
|
51
|
+
const { remoteInfo } = args;
|
|
52
|
+
replaceObjectLocalhost("entry", remoteInfo);
|
|
53
|
+
return args;
|
|
54
|
+
},
|
|
55
|
+
beforeLoadRemoteSnapshot(args) {
|
|
56
|
+
const { moduleInfo } = args;
|
|
57
|
+
if ("entry" in moduleInfo) {
|
|
58
|
+
replaceObjectLocalhost("entry", moduleInfo);
|
|
59
|
+
return args;
|
|
60
|
+
}
|
|
61
|
+
if ("version" in moduleInfo) {
|
|
62
|
+
replaceObjectLocalhost("version", moduleInfo);
|
|
63
|
+
}
|
|
64
|
+
return args;
|
|
65
|
+
},
|
|
66
|
+
loadRemoteSnapshot(args) {
|
|
67
|
+
const { remoteSnapshot } = args;
|
|
68
|
+
if ("publicPath" in remoteSnapshot) {
|
|
69
|
+
replaceObjectLocalhost("publicPath", remoteSnapshot);
|
|
70
|
+
}
|
|
71
|
+
if ("getPublicPath" in remoteSnapshot) {
|
|
72
|
+
replaceObjectLocalhost("getPublicPath", remoteSnapshot);
|
|
73
|
+
}
|
|
74
|
+
if (remoteSnapshot.remotesInfo) {
|
|
75
|
+
Object.keys(remoteSnapshot.remotesInfo).forEach((key) => {
|
|
76
|
+
const remoteInfo = remoteSnapshot.remotesInfo[key];
|
|
77
|
+
replaceObjectLocalhost("matchedVersion", remoteInfo);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
58
80
|
return args;
|
|
59
81
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return args;
|
|
64
|
-
},
|
|
65
|
-
loadRemoteSnapshot(args) {
|
|
66
|
-
const { remoteSnapshot } = args;
|
|
67
|
-
if ("publicPath" in remoteSnapshot) {
|
|
68
|
-
replaceObjectLocalhost("publicPath", remoteSnapshot);
|
|
69
|
-
}
|
|
70
|
-
if ("getPublicPath" in remoteSnapshot) {
|
|
71
|
-
replaceObjectLocalhost("getPublicPath", remoteSnapshot);
|
|
72
|
-
}
|
|
73
|
-
if (remoteSnapshot.remotesInfo) {
|
|
74
|
-
Object.keys(remoteSnapshot.remotesInfo).forEach((key) => {
|
|
75
|
-
const remoteInfo = remoteSnapshot.remotesInfo[key];
|
|
76
|
-
replaceObjectLocalhost("matchedVersion", remoteInfo);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return args;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
+
};
|
|
83
|
+
};
|
|
82
84
|
var resolve_entry_ipv4_default = resolveEntryIpv4Plugin;
|
|
@@ -0,0 +1,82 @@
|
|
|
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 dataLoaderPlugin_exports = {};
|
|
20
|
+
__export(dataLoaderPlugin_exports, {
|
|
21
|
+
default: () => dataLoaderPlugin_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dataLoaderPlugin_exports);
|
|
24
|
+
var import_runtime = require("@module-federation/enhanced/runtime");
|
|
25
|
+
var import_sdk = require("@module-federation/sdk");
|
|
26
|
+
var import_fetchRemoteFullRoutesMap = require("./fetchRemoteFullRoutesMap");
|
|
27
|
+
var import_utils = require("../../runtime/dataLoader/utils");
|
|
28
|
+
var import_constant = require("../../constant");
|
|
29
|
+
var dataLoaderPlugin_default = ({ runtimeOptions, partialSSRRemotes, ssrByRouteIdsMap }) => ({
|
|
30
|
+
name: "MFDataLoaderServerPlugin",
|
|
31
|
+
pre: [
|
|
32
|
+
"@modern-js/plugin-inject-resource"
|
|
33
|
+
],
|
|
34
|
+
setup(api) {
|
|
35
|
+
const { remotes, name } = runtimeOptions;
|
|
36
|
+
if (!remotes.length) {
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
let isHandled = false;
|
|
40
|
+
return {
|
|
41
|
+
prepare() {
|
|
42
|
+
const { middlewares } = api.useAppContext();
|
|
43
|
+
middlewares.push({
|
|
44
|
+
name: "MFDataLoaderServerPlugin",
|
|
45
|
+
handler: async (c, next) => {
|
|
46
|
+
const serverManifest = c.get("serverManifest");
|
|
47
|
+
const { loaderBundles, nestedRoutesJson } = serverManifest;
|
|
48
|
+
if (isHandled) {
|
|
49
|
+
await next();
|
|
50
|
+
} else {
|
|
51
|
+
var _api_useConfigContext_server;
|
|
52
|
+
const instance = (0, import_runtime.init)({
|
|
53
|
+
name,
|
|
54
|
+
remotes
|
|
55
|
+
});
|
|
56
|
+
const remoteFullRoutesMap = await (0, import_fetchRemoteFullRoutesMap.fetchRemoteFullRoutesMap)({
|
|
57
|
+
instance,
|
|
58
|
+
remotePath: (0, import_sdk.isBrowserEnv)() ? `${import_constant.DEFAULT_ENTRY}/${import_constant.MF_ROUTES}` : `${import_constant.DEFAULT_ENTRY}/${import_constant.MODERN_JS_ROUTE_SERVER_LOADER}`
|
|
59
|
+
});
|
|
60
|
+
const originalSSRByRouteIds = (_api_useConfigContext_server = api.useConfigContext().server) === null || _api_useConfigContext_server === void 0 ? void 0 : _api_useConfigContext_server.ssrByRouteIds;
|
|
61
|
+
if (originalSSRByRouteIds && partialSSRRemotes) {
|
|
62
|
+
const remoteSSRByRouteIds = (0, import_fetchRemoteFullRoutesMap.getSSRByRouteIds)(partialSSRRemotes, remoteFullRoutesMap) || [];
|
|
63
|
+
const ssrByRouteIds = /* @__PURE__ */ new Set([
|
|
64
|
+
...originalSSRByRouteIds,
|
|
65
|
+
...remoteSSRByRouteIds.map((id) => ssrByRouteIdsMap[id] || id)
|
|
66
|
+
]);
|
|
67
|
+
api.useConfigContext().server.ssrByRouteIds = Array.from(ssrByRouteIds);
|
|
68
|
+
}
|
|
69
|
+
(0, import_utils.injectRemoteRoutes)(loaderBundles, remoteFullRoutesMap);
|
|
70
|
+
(0, import_utils.injectRemoteRoutes)(nestedRoutesJson, remoteFullRoutesMap);
|
|
71
|
+
isHandled = true;
|
|
72
|
+
await next();
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
before: [
|
|
76
|
+
"render"
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
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 fetchRemoteFullRoutesMap_exports = {};
|
|
20
|
+
__export(fetchRemoteFullRoutesMap_exports, {
|
|
21
|
+
fetchRemoteFullRoutesMap: () => fetchRemoteFullRoutesMap,
|
|
22
|
+
getSSRByRouteIds: () => getSSRByRouteIds
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(fetchRemoteFullRoutesMap_exports);
|
|
25
|
+
async function fetchRemoteFullRoutesMap(options) {
|
|
26
|
+
const { instance, remotePath } = options;
|
|
27
|
+
const { remotes } = instance.options;
|
|
28
|
+
const remoteRoutesMap = {};
|
|
29
|
+
if (!remotes.length) {
|
|
30
|
+
return remoteRoutesMap;
|
|
31
|
+
}
|
|
32
|
+
await Promise.all(remotes.map(async (remote) => {
|
|
33
|
+
const remoteId = `${remote.name}/${remotePath}`;
|
|
34
|
+
const { routes } = await instance.loadRemote(remoteId);
|
|
35
|
+
remoteRoutesMap[remote.name] = {
|
|
36
|
+
routes
|
|
37
|
+
};
|
|
38
|
+
}));
|
|
39
|
+
return remoteRoutesMap;
|
|
40
|
+
}
|
|
41
|
+
function getSSRByRouteIds(partialSSRRemotes, remoteRoutesMap) {
|
|
42
|
+
if (!partialSSRRemotes.length) {
|
|
43
|
+
return void 0;
|
|
44
|
+
}
|
|
45
|
+
const remoteProviderRouteIds = /* @__PURE__ */ new Set();
|
|
46
|
+
const collectIds = (route) => {
|
|
47
|
+
remoteProviderRouteIds.add(route.id);
|
|
48
|
+
if (route.children) {
|
|
49
|
+
route.children.forEach((r) => {
|
|
50
|
+
collectIds(r);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
Object.values(remoteRoutesMap).forEach((item) => {
|
|
55
|
+
const { routes } = item;
|
|
56
|
+
routes.forEach((route) => {
|
|
57
|
+
collectIds(route);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return [
|
|
61
|
+
...remoteProviderRouteIds
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
fetchRemoteFullRoutesMap,
|
|
67
|
+
getSSRByRouteIds
|
|
68
|
+
});
|
|
@@ -39,7 +39,7 @@ var import_webpack = require("@module-federation/enhanced/webpack");
|
|
|
39
39
|
var import_rspack = require("@module-federation/enhanced/rspack");
|
|
40
40
|
var import_universe_entry_chunk_tracker_plugin = __toESM(require("@module-federation/node/universe-entry-chunk-tracker-plugin"));
|
|
41
41
|
var import_manifest = require("./manifest");
|
|
42
|
-
var import_constant = require("
|
|
42
|
+
var import_constant = require("../constant");
|
|
43
43
|
function setEnv() {
|
|
44
44
|
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
|
45
45
|
process.env["MF_SSR_PRJ"] = "true";
|