user8400863
user8400863

Reputation: 745

Capacitor 3 and has no exported member PushNotification

I have recently updated my Ionic Project with Capacitor from version 2 to 3.

I am getting the following errors, it seems it's related to the Notification messages plugin from the capacitor. Can someone advise how I can solve this issue?

    ERROR in src/app/myaccount/myaccount.page.ts:38:3 - error TS2305: Module '"../../../node_modules/@capacitor/core/types"' has no exported member 'PushNotification'.
[ng] 38   PushNotification,
[ng]      ~~~~~~~~~~~~~~~~
[ng] src/app/myaccount/myaccount.page.ts:39:3 - error TS2305: Module '"../../../node_modules/@capacitor/core/types"' has no exported member 'PushNotificationToken'.
[ng] 39   PushNotificationToken,
[ng]      ~~~~~~~~~~~~~~~~~~~~~
[ng] src/app/myaccount/myaccount.page.ts:40:3 - error TS2305: Module '"../../../node_modules/@capacitor/core/types"' has no exported member 'PushNotificationActionPerformed'.
[ng] 40   PushNotificationActionPerformed } from '@capacitor/core';

Upvotes: 4

Views: 6604

Answers (1)

simonramosb
simonramosb

Reputation: 71

In capacitor 3, the way of import is different. More like a common npm package.

Old way:

// OLD
import { Plugins } from '@capacitor/core';
const { AnyPlugin } = Plugins;

New way:

// NEW
import { AnyPlugin } from 'any-plugin';

Also, check the documentation page for updating to 3.0 and to know the incompatible plugin changes.

Good luck!

Upvotes: 3

Related Questions