Npm strophe not working

ive tried to npm strophe ,typings and jquery and import it but i get an error here it is:


import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import {Strophe} from 'strophe';

@Component({
selector: 'page-home',
templateUrl: 'home.html',

})
export class HomePage {

public connection: any ;

public BOSH_SERVICE: any="http://52.32.***.5:5280/http-bind/" ;

constructor(public navCtrl: NavController) {

}

login() {

this.connection = new Strophe.Connection(this.BOSH_SERVICE);
this.connection.connect('ama****'+'@'+'localhost', 'o***oop',

this.onConnect);

console.log("Hello World !");

}

onConnect(status) {
console.log('onConnect: '+status);
}

the error:

WEBPACK_IMPORTED_MODULE_2_strophe.Strophe is undefined Stack trace: HomePage.prototype.login@http://localhost:8100/build/main.js:55747:9 View_HomePage_0/<@ng:///AppModule/HomePage.ngfactory.js:135:21 viewDef/handleEvent@http://localhost:8100/build/main.js:12170:98 callWithDebugContext@http://localhost:8100/build/main.js:13462:39 debugHandleEvent@http://localhost:8100/build/main.js:13050:12 dispatchEvent@http://localhost:8100/build/main.js:9070:12 renderEventHandlerClosure/<@http://localhost:8100/build/main.js:9662:20 decoratePreventDefault/<@http://localhost:8100/build/main.js:33505:53 fhttp://localhost:8100/build/polyfills.js:3:9644 NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@htt p://localhost:8100/build/main.js:4397:28 fhttp://localhost:8100/build/polyfills.js:3:9557 chttp://localhost:8100/build/polyfills.js:3:4812 t/this.invoke@http://localhost:8100/build/polyfills.js:3:10626

Any solutions i need it asap!!!

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

Looks like it doesn’t play nicely with webpack.

thanks i did wrap them

1 Like