Use common node package in Angular2

Viewed 59

I'm trying to use a common node module ( websocket ) that's not made for TS in my Angular2 app.I also installed @types/websocket and imported it in my service this way:

import * as WebSocket from 'websocket';

or

import { client } from 'websocket';

and instantiate that, there is no errors in VScode or on ngBuild, but in my browser console I got this error:

TypeError: __WEBPACK_IMPORTED_MODULE_1_websocket__.client is not a constructor

but it is actually a constructor! I use it in expressjs and regular node and every thing is ok tehre.

0 Answers
Related