在预览模式下如何在NativeScript中建立npm依赖关系?

时间:2019-05-02 08:41:24

标签: nativescript angular2-nativescript

我在package.json中使用 NativeScript 和npm依赖项。当我使用命令tns preview启动应用程序时,它为我准备好了错误的应用程序:

Plugin @ngx-translate/core is not included in preview app on device

我的 package.json 是:

{
"dependencies": {
 "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0"
}
}

我想NativeScript在这种模式下不会建立npm依赖关系,或者这些依赖关系不兼容。

1 个答案:

答案 0 :(得分:2)

Nativescript预览功能仅限于已编译的模块。这样说来,如果要包含外部依赖项,则不能使用Preview,因此需要使用tns run命令。

请参阅以下SO问题,因为这可能是重复的:Error: 'tns preview' - Plugin not include

编辑:请检查@Manoj对此评论的回复,因为我很普通,他对您可以在预览版中使用的某些内容很感兴趣。