Skip to content

Commit 425fc9d

Browse files
authored
fix: only delete can be configurable descriptor (#2518)
1 parent 364f2bc commit 425fc9d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/popular-fishes-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/runtime': patch
3+
---
4+
5+
fix: only delete can be configurable descriptor

packages/runtime/src/remote/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,10 @@ export class RemoteHandler {
410410
const remoteInfo = loadedModule.remoteInfo;
411411
const key = remoteInfo.entryGlobalName as keyof typeof globalThis;
412412

413-
if (globalThis[key]) {
413+
if (
414+
globalThis[key] &&
415+
Object.getOwnPropertyDescriptor(globalThis, key)?.configurable
416+
) {
414417
delete globalThis[key];
415418
}
416419
const remoteEntryUniqueKey = getRemoteEntryUniqueKey(

0 commit comments

Comments
 (0)