在 Nativescript 代码共享项目中使用 Angular 库

在 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.