We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca8fe14 commit 0e93f66Copy full SHA for 0e93f66
packages/plugins/driver-memory/src/memory-driver.ts
@@ -1082,9 +1082,13 @@ export class InMemoryDriver implements IDataDriver {
1082
1083
/**
1084
* Detect whether the current runtime is a browser environment.
1085
+ * Checks for window, document AND a functional localStorage to avoid
1086
+ * false positives in Node.js runtimes that partially polyfill globals.
1087
*/
1088
private isBrowserEnvironment(): boolean {
- return typeof globalThis.localStorage !== 'undefined';
1089
+ return typeof globalThis.window !== 'undefined'
1090
+ && typeof globalThis.document !== 'undefined'
1091
+ && typeof globalThis.localStorage?.setItem === 'function';
1092
}
1093
1094
0 commit comments