fix(ssr): remove window polyfill that broke Inertia SSR detection (typeof window check)

This commit is contained in:
F4ilji
2026-07-06 18:53:06 +05:00
parent 5fddb97cbf
commit f575325fa7
+2 -6
View File
@@ -9,7 +9,7 @@ if (typeof globalThis.IntersectionObserver === 'undefined') {
if (typeof globalThis.localStorage === 'undefined') {
const noop = () => '';
globalThis.localStorage = { getItem: noop, setItem: noop, removeItem: noop, clear: noop, get length() { return 0; }, key: noop };
globalThis.localStorage = { getItem: noop, setItem: noop, removeEventListener: noop, removeItem: noop, clear: noop, get length() { return 0; }, key: noop };
}
if (typeof globalThis.sessionStorage === 'undefined') {
@@ -17,11 +17,7 @@ if (typeof globalThis.sessionStorage === 'undefined') {
globalThis.sessionStorage = { getItem: noop, setItem: noop, removeItem: noop, clear: noop, get length() { return 0; }, key: noop };
}
if (typeof globalThis.window === 'undefined') {
globalThis.window = globalThis;
globalThis.window.addEventListener = () => {};
globalThis.window.removeEventListener = () => {};
}
// NOTE: Do NOT polyfill globalThis.window — Inertia checks `typeof window === "undefined"` to detect SSR
if (typeof globalThis.document === 'undefined') {
const el = { style: {}, appendChild: () => {}, removeChild: () => {}, addEventListener: () => {}, removeEventListener: () => {} };