I'm having a problem trying to build my application. When running in dev mode, it works perfectly, but when I build it it gives window is not defined.
export function socketConnect (): SocketI {
if (typeof window.gqlsocket === 'undefined') {
const socket = initializeSocket()
window.gqlsocket = socket
return socket
} else {
return window.gqlsocket
}
}
export function socketDisconnect (): void {
if (typeof window.gqlsocket !== 'undefined') {
window.gqlsocket.disconnect(() => (window.gqlsocket = undefined))
}
}
const client = createClient({...})
export const install: ModuleInstall = ({ app, isClient }) => {
if (!isClient) return
app.use(urql, client)
}
