Hello,
Whenever I try to install a plugin nowadays, the import declaration is followed by an ‘/ngx
’ suffix (ex.@ionic-native/onesignal/ngx
) and whenever I try to use it, it always throws an
TypeError: Object(...) is not a function
exception
it’s happening for every plugin I try to import.
ionic info
gives:
Ionic:
ionic (Ionic CLI) : 4.5.0 (C:\Users\MEeZkAkpNmZaWcBX7UuQhvr2eHUjkqNe8Gules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0
Capacitor:
capacitor (Capacitor CLI) : 1.0.0-beta.17
@capacitor/core : 1.0.0-beta.17
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, browser 5.0.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 13 other plugins)
System:
NodeJS : v8.12.0 (D:\Windows\Programs\Node JS\node.exe)
npm : 6.4.1
OS : Windows 10
I always install the latest plugin version according to the Docs.
my current code is :
import { OneSignal } from '@ionic-native/onesignal/ngx';
constructor(platform: Platform, statusBar: StatusBar, public splashScreen: SplashScreen, private oneSignal: OneSignal) {
platform.ready().then(() => {
oneSignal.startInit('x', 'y'); /* this invokes the exception (btw, I do have the
credentials but for this example it is replaced by 'x' and 'y'*/
}
}