在 Nativescript 代码共享项目中使用 Angular 库 [英] Using Angular libraries in Nativescript code sharing project

查看:28
本文介绍了在 Nativescript 代码共享项目中使用 Angular 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用新的 @nativescript/schematics 将 Angular 应用程序迁移到带有 Nativescript 的共享代码库,但是,我在构建移动版本的 Angular 库时遇到了问题应用程序.我使用 angular-cli 创建库(ng generate library).

I'm trying to migrate an Angular app to a shared codebase with Nativescript using the new @nativescript/schematics, however, I'm having problems importing my Angular library when building the mobile version of the app. I used the angular-cli to create the library (ng generate library).

对于网络版本,我所要做的就是使用 ng build library-name 单独构建库,然后允许我将其导入主应用程序.

For the web version, all I had to do was build the library separately using ng build library-name which then allowed me to import it into the main application.

如何在运行 tns run ios --bundle 时构建可以导入到主应用程序的库的移动版本?我已经使用适当的 *.tns 文件迁移了库的组件和模块.

How can I build a mobile version of the library that can be imported into the main application when running tns run ios --bundle? I've already migrated the components and module of the library with appropriate *.tns files.

感谢任何帮助

推荐答案

很抱歉,这只是一个超链接答案,但在我看来,回答这个问题所需的空间太大了.我刚刚完成了一个 repo 我一直在努力做到这一点.我有一大堆 angular web 库,现在我想使用 NativeScript 将它们用于移动设备.我已经把我到目前为止学到的一切都放到了这个 repo 中,希望对你有所帮助

I'm sorry this is just a hyperlink answer but the space required to answer this, in my opinion, is way too large. I just finished finalizing a repo I've been working on to do exactly this. I have a whole slew of angular web libraries that I now want to make available for use on mobile using NativeScript. I have put everything I have learned so far into this repo and I hope it helps you too.

感谢@Rohit 的最终推送/想法,执行他建议的脚本位于此 repo 的 test-lib/gulpfile.js 中.

Thanks for the final push/idea @Rohit, a script for doing what he suggests is in the test-lib/gulpfile.js of this repo.

这篇关于在 Nativescript 代码共享项目中使用 Angular 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆