Skip to content

Commit 91ea1ea

Browse files
committed
fix: clear module entry
1 parent bdf123f commit 91ea1ea

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

packages/runtime/assets/harness-module-system.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@
102102
}
103103
}
104104
newMod.isInitialized = false;
105+
// Reset publicModule.exports to ensure a clean start
106+
// This is crucial because if we reuse the old exports object,
107+
// the module factory might append to it instead of overwriting it,
108+
// or we might be left with stale state (e.g., class definitions)
109+
newMod.publicModule = { exports: {} };
110+
111+
// Also clear error state
112+
newMod.hasError = false;
113+
newMod.error = undefined;
114+
105115
modules.set(moduleId, newMod);
106116
}
107117
});
@@ -116,4 +126,4 @@
116126
: typeof window !== 'undefined'
117127
? window
118128
: this
119-
);
129+
);

0 commit comments

Comments
 (0)