@ice/mf-runtime 1.0.5-beta.0 → 1.0.5
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/es2017/runtime-plugin.js +15 -11
- package/esm/runtime-plugin.js +15 -11
- package/package.json +1 -1
package/es2017/runtime-plugin.js
CHANGED
|
@@ -87,19 +87,23 @@ export const runtimePlugin = ()=>({
|
|
|
87
87
|
async beforeRequest (args) {
|
|
88
88
|
const remoteName = args.id.split('/')[0];
|
|
89
89
|
const hostName = args.options.name;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
try {
|
|
91
|
+
// 清除 window 上带版本号的模块(如果存在)
|
|
92
|
+
if (args.id.includes('/')) {
|
|
93
|
+
var _microMod;
|
|
94
|
+
const moduleNameWithDash = remoteName; // 如 guanghe-workspace
|
|
95
|
+
const microMod = getMicroMod(moduleNameWithDash);
|
|
96
|
+
if ((_microMod = microMod) === null || _microMod === void 0 ? void 0 : _microMod.moduleFederatedName) {
|
|
97
|
+
const versionedModuleName = microMod.moduleFederatedName;
|
|
98
|
+
if (window[versionedModuleName]) {
|
|
99
|
+
console.log(`[beforeRequest] Clearing versioned module from window: ${versionedModuleName}`);
|
|
100
|
+
// @ts-expect-error for global module
|
|
101
|
+
window[versionedModuleName] = null;
|
|
102
|
+
}
|
|
101
103
|
}
|
|
102
104
|
}
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error('[beforeRequest] error', error);
|
|
103
107
|
}
|
|
104
108
|
if (!hasConflict(hostName, remoteName)) {
|
|
105
109
|
return args;
|
package/esm/runtime-plugin.js
CHANGED
|
@@ -167,19 +167,23 @@ export var runtimePlugin = function() {
|
|
|
167
167
|
return _ts_generator(this, function(_state) {
|
|
168
168
|
remoteName = args.id.split("/")[0];
|
|
169
169
|
hostName = args.options.name;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
170
|
+
try {
|
|
171
|
+
// 清除 window 上带版本号的模块(如果存在)
|
|
172
|
+
if (args.id.includes("/")) {
|
|
173
|
+
;
|
|
174
|
+
moduleNameWithDash = remoteName; // 如 guanghe-workspace
|
|
175
|
+
microMod = getMicroMod(moduleNameWithDash);
|
|
176
|
+
if ((_microMod = microMod) === null || _microMod === void 0 ? void 0 : _microMod.moduleFederatedName) {
|
|
177
|
+
versionedModuleName = microMod.moduleFederatedName;
|
|
178
|
+
if (window[versionedModuleName]) {
|
|
179
|
+
console.log("[beforeRequest] Clearing versioned module from window: ".concat(versionedModuleName));
|
|
180
|
+
// @ts-expect-error for global module
|
|
181
|
+
window[versionedModuleName] = null;
|
|
182
|
+
}
|
|
181
183
|
}
|
|
182
184
|
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error("[beforeRequest] error", error);
|
|
183
187
|
}
|
|
184
188
|
if (!hasConflict(hostName, remoteName)) {
|
|
185
189
|
return [
|