Skip to content

Commit 6e7d51d

Browse files
authored
Merge pull request #1058 from aortbals/fix-process-undefined
Check if `process` is defined (for usage in the browser)
2 parents a9ab37d + b52c65a commit 6e7d51d

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)