Skip to content

Commit 02ceb53

Browse files
pinkeshmarsPoojaB26
authored andcommitted
Fix Dreamflow local runtime error
1 parent b6c8710 commit 02ceb53

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/js/firebase-analytics.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ const firebaseConfig = {
1111
};
1212

1313
// Initialize Firebase Analytics
14-
if (typeof window !== 'undefined') {
14+
// Only run in the browser and in production
15+
if (typeof window === 'undefined' || process.env.NODE_ENV !== 'production') {
16+
// In dev / during SSR, do nothing
17+
// (avoids breaking local Docusaurus)
18+
// You don't need any exports here; it's just a side-effect module.
19+
console.info('Firebase Analytics disabled in dev/SSR.');
20+
} else{
1521
// Load Firebase SDKs dynamically using script tags (compatible with Docusaurus)
1622
const loadFirebaseScript = (src) => {
1723
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)