Skip to content

Commit b52c65a

Browse files
committed
fix: avoid process is undefined error when used in the browser
1 parent e236ca2 commit b52c65a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utilities/assertValidName.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ const NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
1111
const ERROR_PREFIX_RX = /^Error: /;
1212

1313
// Silences warnings if an environment flag is enabled
14-
const noNameWarning =
15-
Boolean(process && process.env && process.env.GRAPHQL_NO_NAME_WARNING);
14+
const noNameWarning = Boolean(
15+
typeof process !== 'undefined' &&
16+
process &&
17+
process.env &&
18+
process.env.GRAPHQL_NO_NAME_WARNING
19+
);
1620

1721
// Ensures console warnings are only issued once.
1822
let hasWarnedAboutDunder = false;

0 commit comments

Comments
 (0)