Skip to content

Commit 3128ce7

Browse files
committed
just do window
1 parent cff1206 commit 3128ce7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/app-compat/src/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,27 @@
1616
*/
1717

1818
import { FirebaseNamespace } from './public-types';
19-
import { isBrowser, getGlobal } from '@firebase/util';
19+
import { isBrowser } from '@firebase/util';
2020
import { firebase as firebaseNamespace } from './firebaseNamespace';
2121
import { logger } from './logger';
2222
import { registerCoreComponents } from './registerCoreComponents';
2323

24+
declare global {
25+
interface Window {
26+
firebase: FirebaseNamespace;
27+
}
28+
}
29+
2430
// Firebase Lite detection
2531
// eslint-disable-next-line @typescript-eslint/no-explicit-any
26-
if (isBrowser() && (getGlobal() as any).firebase !== undefined) {
32+
if (isBrowser() && window.firebase !== undefined) {
2733
logger.warn(`
2834
Warning: Firebase is already defined in the global scope. Please make sure
2935
Firebase library is only loaded once.
3036
`);
3137

3238
// eslint-disable-next-line
33-
const sdkVersion = ((getGlobal() as any).firebase as FirebaseNamespace)
34-
.SDK_VERSION;
39+
const sdkVersion = (window.firebase as FirebaseNamespace).SDK_VERSION;
3540
if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {
3641
logger.warn(`
3742
Warning: You are trying to load Firebase while using Firebase Performance standalone script.

0 commit comments

Comments
 (0)