Do not throw error if window is undefined due to Next

This commit is contained in:
Tat Dat Duong
2025-03-27 21:03:54 +01:00
parent 5cdab86d48
commit 3ba7c7fbed
+1 -3
View File
@@ -203,9 +203,7 @@ declare global {
}
export function experimental_loadShare(name: string, module: unknown) {
if (typeof window === "undefined") {
throw new Error("Cannot register module in server context");
}
if (typeof window === "undefined") return;
window[REQUIRE_EXTRA_SYMBOL] ??= {};
window[REQUIRE_EXTRA_SYMBOL][name] = module;