Skip to content

Commit a07afb1

Browse files
committed
Add condition to only get analytics in production mode
1 parent 152b434 commit a07afb1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

components/Toast.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import React, { useEffect } from "react";
2-
import { Fragment, useState } from "react";
1+
import { ToastInterface } from "@/types";
32
import { Transition } from "@headlessui/react";
3+
import { XMarkIcon } from "@heroicons/react/20/solid";
44
import {
55
CheckCircleIcon,
66
InformationCircleIcon,
77
XCircleIcon,
88
} from "@heroicons/react/24/outline";
9-
import { XMarkIcon } from "@heroicons/react/20/solid";
10-
import { ToastInterface, ToastVariantType } from "@/types";
9+
import React, { Fragment, useEffect, useState } from "react";
1110

1211
interface Props extends ToastInterface {
1312
onClose: () => void;

config/firebase.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { initializeApp } from "firebase/app";
22
import { Firestore, getFirestore } from "firebase/firestore";
33
import { Auth, getAuth } from "firebase/auth";
4-
import { Analytics, getAnalytics, isSupported } from "firebase/analytics";
4+
import { Analytics, getAnalytics } from "firebase/analytics";
55

66
let auth: Auth | undefined;
77
let db: Firestore | undefined;
@@ -22,7 +22,9 @@ try {
2222

2323
auth = getAuth(app);
2424
db = getFirestore(app);
25-
if (typeof window !== "undefined") analytics = getAnalytics(app);
25+
if (process.env.NODE_ENV === "production" && typeof window !== "undefined") {
26+
analytics = getAnalytics(app);
27+
}
2628
} catch (error) {
2729
console.log(
2830
Error(

0 commit comments

Comments
 (0)