Skip to content

Commit

Permalink
remove dependency on global (#2268)
Browse files Browse the repository at this point in the history
  • Loading branch information
acao authored Mar 31, 2022
1 parent fe44127 commit b188682
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-jokes-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"graphiql": patch
---

remove dependency on `global` for esbuild/etc users!
6 changes: 3 additions & 3 deletions packages/graphiql/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if (majorVersion < 16) {
);
}

declare namespace global {
declare namespace window {
export let g: GraphiQL;
}

Expand Down Expand Up @@ -640,8 +640,8 @@ export class GraphiQL extends React.Component<GraphiQLProps, GraphiQLState> {
// Utility for keeping CodeMirror correctly sized.
this.codeMirrorSizer = new CodeMirrorSizer();

if (global !== undefined) {
global.g = this;
if (typeof window !== 'undefined') {
window.g = this;
}
}
UNSAFE_componentWillMount() {
Expand Down

0 comments on commit b188682

Please sign in to comment.