nativescript - 升级 Nativescript 插件时缺少参考(tns-core-modules → @nativescript/core 迁移)
问题描述
我正在更新现有插件,以使其与即将发布的 nativescript 版本兼容。
对包的所有引用tns-core-modules
都已替换为@nativescript/core
.
发布的文档说新库应该与旧版本兼容。不幸的是,在这种情况下,某些东西肯定发生了变化(与视图生命周期有关),并且插件不是 100% 工作的。
这就是为什么我尝试完全迁移它的依赖项,但是由于一些错误,构建过程是不可能的:
node_modules/@nativescript/core/ui/frame/index.d.ts:494:38 - error TS2304: Cannot find name 'ModuleContext'.
494 export function reloadPage(context?: ModuleContext): void;
...
map-view.ios.ts:80:40 - error TS2304: Cannot find name 'WeakRef'.
80 public static initWithOwner(owner: WeakRef<MapView>): MapViewDelegateImpl {
node_modules/@nativescript/core/ui/styling/style/index.d.ts:31:39 - error TS2304: Cannot find name 'WeakRef'.
31 constructor(ownerView: ViewBase | WeakRef<ViewBase>);
我可以通过skipLibCheck: true
在 tsconfig.json 中设置来构建插件。它使插件编译,但问题稍后在运行时出现。所以必须解决才能完成迁移。
有什么提示吗?
谢谢!
解决方案
也许这不是 100% 推荐的解决方案,但如果您确实遇到同样的问题,请将此行添加到您的 tsconfig.json:
"types": [
"@nativescript/core",
],
推荐阅读
- r - 比较 tibble 中不同长度的组
- angular - Angular 反应式表单验证
- java - 在 BitBucket 存储库中托管可执行 .jar 文件或自动将可执行 .jar 文件从 git 打包到本地文件夹中
- python - Django:消息出现两次
- c# - 在 ASP.NET Core 中的方法中注入依赖项
- c# - 读取没有值的 ini 部分并将其附加到字典中
- wso2 - WSO2 API Manager 2.6 中缺少帐户管理策略选项卡
- python - Pandas 'builder 模式' vs inplace 函数,内存使用
- c# - 我试图让玩家向前移动一个固定的距离,但它只能工作一次。如何让玩家多次移动?
- typescript - 如何到同一个站点 没有或不是 seame 站点 url cookie chrome http 连接