I try to use the QuickBlox JavaScript SDK in an Angular 4 browser app.
At first I created a new project using Angular-CLI. Then I installed QuickBox using
npm install quickblox --save
In my app.component.ts
I added this import
import { QB } from 'quickblox';
When I try to use QB in my code webpack fails to compile with the following error:
ERROR in ./~/node-xmpp-client/lib/Client.js
Module not found: Error: Can't resolve 'child_process' in 'C:\dev\workspace_js\qb\node_modules\node-xmpp-client\lib'
@ ./~/node-xmpp-client/lib/Client.js 15:11-35
@ ./~/node-xmpp-client/index.js
@ ./~/quickblox/src/modules/qbChat.js
@ ./~/quickblox/src/qbMain.js
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
I tried to add QB to the app.module.ts
, installed the node-xmpp-client
package but nothing works.
Maybe my import statement is wrong? The docs only shows how to use it with require
.
How can I use QuickBlox with Angular 4? Can I use the npm package for a client side (browser) application?