Observables not working with latest version of ionic (v 2.0.0-rc.3)


#1

Is there a reason why Observables are using a webpack import library (WEBPACK_IMPORTED_MODULE_1_rxjs_Observable[“Observable”]) instead of using the rxjs Observable library (Observable_1.Observable) when I serve my ionic 2 app. The following are the dependencies from my package.json:

“dependencies”: {
"@angular/common": “2.1.1”,
"@angular/compiler": “2.1.1”,
"@angular/compiler-cli": “2.1.1”,
"@angular/core": “2.1.1”,
"@angular/forms": “2.1.1”,
"@angular/http": “2.1.1”,
"@angular/platform-browser": “2.1.1”,
"@angular/platform-browser-dynamic": “2.1.1”,
"@angular/platform-server": “2.1.1”,
"@ionic/storage": “1.1.6”,
“ionic-angular”: “2.0.0-rc.3”,
“ionic-native”: “2.2.3”,
“ionicons”: “3.0.0”,
“rxjs”: “5.0.0-beta.12”,
“zone.js”: “0.6.26”
},
“devDependencies”: {
"@ionic/app-scripts": “0.0.45”,
“typescript”: “2.0.10”
},
“cordovaPlugins”: [
“cordova-plugin-whitelist”,
“cordova-plugin-statusbar”,
“cordova-plugin-console”,
“cordova-plugin-device”,
“cordova-plugin-splashscreen”,
“ionic-plugin-keyboard”
],
“cordovaPlatforms”: [
“ios”,
{
“platform”: “ios”,
“version”: “”,
“locator”: “ios”
}
],


#2

That’s just because the code is bundled with Webpack. What’s your problem exactly?


#3

Apologies for not explaining well enough. I’ve recently developed an app on ionic beta that doesn’t use webpack and hence the confusion once I upgraded to rc. I understand that the latest rc of ionic is bundled with webpack but for some odd reason the observable wasn’t getting invoked.

After spending time on it I realised the CWD wasn’t set properly for the project. The reason was that I had created a project and deleted it’s contents and re-created another project in the same directory. This caused the CWD to point to the deleted directory in my trash (mac) folder. And hence the libraries weren’t getting found in runtime. All I had to do was do a cd … and cd back into the directory to reset the CWD.

Oddly enough, ionic serve worked fine. Anyways we can mark this issue closed now. I just wanted to share this so that others can benefit from my experience.

Cheers