如何从从 tns-core-modules 导入对象切换到 @nativescript/core?

How do you switch from importing objects from tns-core-modules to @nativescript/core?

好的,所以我 运行 命令“ns migrate”使用较新版本的 nativescript。它所做的是删除 tns-core-modules 依赖项,这意味着我不能再用它来导入东西了。据说我们应该改用@nativescript/core,但问题是当我尝试导入对象时@nativescript/core 不起作用并且我收到“找不到模块'@nativescript/core' 或其相应的类型声明"。

例如,这将不起作用:

import { Label } from "@nativescript/core";

但是有了 tns-core-modules 依赖,它就起作用了,而且非常简单:

import { Label } from "tns-core-modules/ui/label"

在 运行 ns 迁移命令之后,它删除了 tns-core-modules 并将 @nativescript/core 更新为 7.3.0

我是不是输入错误了??

run npm install @nativescript/core

那么这应该可以工作

import { Label } from "@nativescript/core";

我用

import { ApplicationSettings, ImageSource } from '@nativescript/core';

在我最近的项目中