Skip to content

Commit 0b23f53

Browse files
committed
fix ws browser
1 parent 4422fa2 commit 0b23f53

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

client.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import { ApolloLink, concat, split } from 'apollo-link';
44
import { WebSocketLink } from 'apollo-link-ws';
55
import fetch from 'node-fetch';
66
import path from 'path';
7-
import ws from 'ws';
87
import { debug } from './debug';
98

109
const moduleLog = debug.extend('client')
1110

11+
let ws;
12+
if (typeof(window) !== 'object') {
13+
ws = require('ws');
14+
}
15+
1216
const DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.DEEP_FOUNDATION_HASURA_RELATIVE);
1317
const NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE);
1418

0 commit comments

Comments
 (0)