电容器 3 并且没有导出成员 PushNotification
Capacitor 3 and has no exported member PushNotification
我最近将我的带有 Capacitor 的 Ionic 项目从版本 2 更新到版本 3。
我收到以下错误,似乎与电容器的通知消息插件有关。有人可以告诉我如何解决这个问题吗?
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';
电容3的导入方式不同。更像是一个普通的 npm 包。
旧方法:
// OLD
import { Plugins } from '@capacitor/core';
const { AnyPlugin } = Plugins;
新方式:
// NEW
import { AnyPlugin } from 'any-plugin';
另外,检查 documentation 页面更新到 3.0 并了解不兼容的插件更改。
祝你好运!
我最近将我的带有 Capacitor 的 Ionic 项目从版本 2 更新到版本 3。
我收到以下错误,似乎与电容器的通知消息插件有关。有人可以告诉我如何解决这个问题吗?
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';
电容3的导入方式不同。更像是一个普通的 npm 包。
旧方法:
// OLD
import { Plugins } from '@capacitor/core';
const { AnyPlugin } = Plugins;
新方式:
// NEW
import { AnyPlugin } from 'any-plugin';
另外,检查 documentation 页面更新到 3.0 并了解不兼容的插件更改。
祝你好运!