Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 5ae8ff4

Browse files
author
Damon Bauer
authored
fix: ensures process is not undefined before logging to console
ensures process is not undefined before logging to console
1 parent 4ec25e5 commit 5ae8ff4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ResponsiveProvider/useDebugResponsive.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import { useEffect } from 'react';
22

33
const useDebugResponsive = (contextObject, currentMediaType) => {
44
useEffect(() => {
5-
if (process && process.env && process.env.NODE_ENV === 'development') {
5+
const isDevEnv =
6+
typeof process !== 'undefined' &&
7+
process !== null &&
8+
process.env &&
9+
process.env.NODE_ENV === 'development';
10+
11+
if (isDevEnv) {
612
/* eslint-disable no-console */
713
console.group(
814
'%c @farfetch/react-context-responsive updated!',

0 commit comments

Comments
 (0)