Ionic 2 RC0 - Authentication with Cloud Angular or ng2 Cordova not working


#1

Hello,

Has anyone run into this problem ? I am using Ionic 2 Cloud Module to authenticate. I also tryed using ng2-cordova-oauth and I get a similar error.

Error: Module .../node_modules/@ionic/cloud-angular/dist/es5/index.js does not export CloudModule
? 

Thank you !


#2

I have the same issue, comment please if fix it! Thanks a lot


Dependencies for Cloud Client?
#3

Same issue here! Any workarounds until a fix is out? Simply adding it manually through a custom rollup file (like with other external libraries) does not work. When I tried I received the error “duplicate export…”


#4

So, I got it working for me.

It appears that this error only occurs when you have a custom rollup.config.js file with some include & namedExports specified for the commonJS plugin. I had to adapt my rollup config in order to get rid of the error.

Please see my original rollup config below:

commonjs({
include: [
‘node_modules/rxjs/’,
'node_modules/firebase/
’,
‘node_modules/angularfire2/’,
'node_modules/ng2-charts/

],
namedExports: {
‘node_modules/firebase/firebase.js’: [‘initializeApp’, ‘auth’, ‘database’],
‘node_modules/angularfire2/node_modules/firebase/firebase-browser.js’: [‘initializeApp’, ‘auth’, ‘database’],
‘node_modules/ng2-charts/ng2-charts.js’: [‘ChartsModule’]
}
}),

I had to change that so that the “include” array only consists of "node_modules/" like so:

commonjs({
include: [
'node_modules/

],
namedExports: {
‘node_modules/firebase/firebase.js’: [‘initializeApp’, ‘auth’, ‘database’],
‘node_modules/angularfire2/node_modules/firebase/firebase-browser.js’: [‘initializeApp’, ‘auth’, ‘database’],
‘node_modules/ng2-charts/ng2-charts.js’: [‘ChartsModule’]
}
}),

Sorry for copy-pasting the code. Didn’t figure out how to include coding.

Hope it helps!


#5

Interesting thank you. Also you may want to only include the packages that are causing you issues. 'node_modules/@ionic/cloud-angular/**'


#6

I also tried that before switching to node_modules/** but it yielded the same error. For me including the entire node_modules directory is the only way it works for now.


#7

I solved for ng2-cordova-oauth

edit
node_modules/@ionic/app-scripts/config/rollup.config.js
and add:

plugins: [
ngTemplate(),
commonjs({
include: [
‘node_modules/**’
],
namedExports: {
‘node_modules/ng2-cordova-oauth/core.js’: [‘CordovaOauth’,‘Facebook’,‘Google’] //and other providers you use
}
}),


#8

For some reason, I installed the app-scripts beta and now it’s working for me without modifying the rollup.config.js…