diff --git a/angular-websocket.js b/angular-websocket.js index 04e24a9..85b294a 100644 --- a/angular-websocket.js +++ b/angular-websocket.js @@ -346,7 +346,7 @@ } // CommonJS - if (typeof exports === 'object' && require) { + if (typeof exports === 'object' && typeof require === 'function') { try { ws = require('ws'); Socket = (ws.Client || ws.client || ws); diff --git a/dist/angular-websocket.js b/dist/angular-websocket.js index 04e24a9..85b294a 100644 --- a/dist/angular-websocket.js +++ b/dist/angular-websocket.js @@ -346,7 +346,7 @@ } // CommonJS - if (typeof exports === 'object' && require) { + if (typeof exports === 'object' && typeof require === 'function') { try { ws = require('ws'); Socket = (ws.Client || ws.client || ws);