Ionic 4 native plugin problem

When I run the “ionic serve” I’m getting this error message:

Uncaught TypeError: Object(…) is not a function
at index.js:685
at Object…/node_modules/@ionic-native/calendar/index.js (index.js:888)
at webpack_require (bootstrap:81)
at Object…/src/app/app.module.ts (app.component.ts:11)
at webpack_require (bootstrap:81)
at Object…/src/main.ts (environment.ts:15)
at webpack_require (bootstrap:81)
at Object.0 (main.ts:12)
at webpack_require (bootstrap:81)
at checkDeferredModules (bootstrap:43)

Getting a deeper look into it I saw that the problem is the missing cordova object.

__decorate([
Cordova(), < – Missing object
__metadata(“design:type”, Function),
__metadata(“design:paramtypes”, []),
__metadata(“design:returntype”, Promise)
], Calendar.prototype, “hasReadWritePermission”, null);

I notice that the cordova.js is not imported by index.html.

Is the Ionic 3 native plugins compatible with Ionic 4?

What can I do to solve this problem?

Thanks

1 Like

Have you checked https://github.com/ionic-team/ionic-native/issues?

Update your native libs to 5.0.0-beta.14, each of them inclusive @ionic-native/core

also the imports should contains ngx, like

import {SplashScreen} from '@ionic-native/splash-screen/ngx';
3 Likes

Thanks reedrichards, it worked.
For future reference, here are the packs that I had to install

npm install rxjs@6 rxjs-compat@6 --save
npm install @ionic-native/core@5.0.0-beta.14
npm install --save @ionic-native/calendar@5.0.0-beta.14
npm install --save @ionic-native/status-bar@5.0.0-beta.14

5 Likes

cool. note, rxjs-compat is not mandatory. if you have migrated your rxjs code and if no library you are using are still using the old import you could get rid of rxjs-compat(-ibility)

1 Like

i am having the same issue with

Fingerprint AIO

When I compile using native/core version 5.0.0 give me an error when I compile
any ideas?