如何在预览模式下在 NativeScript 中构建 npm 依赖项?
How to buld npm dependencies in NativeScript in preview mode?
我在 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 依赖项,或者这些依赖项不兼容。
Nativescript 预览功能仅限于已编译的模块。话虽如此,如果您包含外部依赖项,则无法使用预览,因此您需要使用 tns run
命令。
请查看以下 SO 问题,因为这可能是重复的:Error: 'tns preview' - Plugin not include
编辑:请查看@Manoj 对此评论的回复,因为我非常笼统,他对您可能在预览版中使用的一些东西提出了很好的观点。
我在 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 依赖项,或者这些依赖项不兼容。
Nativescript 预览功能仅限于已编译的模块。话虽如此,如果您包含外部依赖项,则无法使用预览,因此您需要使用 tns run
命令。
请查看以下 SO 问题,因为这可能是重复的:Error: 'tns preview' - Plugin not include
编辑:请查看@Manoj 对此评论的回复,因为我非常笼统,他对您可能在预览版中使用的一些东西提出了很好的观点。