-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
I want to:
- report a bug - solved, look last two lines for workaround
Library socket.io-client is not compatible with latest Angular 6. There is error at execution time:
ReferenceError: global is not defined at Object../node_modules/socket.io-client/node_modules/socket.io-parser/is-buffer.js (is-buffer.js:4)
Please read comment below to know more:
angular/angular-cli#9827 (comment)
If you want to see this error for yourself, add to angular 6.0 app simple service like that below:
import { Injectable } from 'angular/core';
import * as socketIo from 'socket.io-client';
@Injectable()
export class SocketService {
private socket;
constructor() {}
public initSocket(): void {
this.socket = socketIo();
}
}Error disappears when you remove initSocket function.
Ok, there is workaround in Angular 6 to work with socket.io-client.
Add (window as any).global = window; to polyfills.ts
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working