How to convert existing NativeScript Angular project to Code Sharing project

╄→гoц情女王★ 提交于 2019-12-24 00:56:25

问题


All available tutorials talk about converting Angular Web Apps to codesharing Nativescript projects. I want to do the opposite.

I almost finished coding the mobile app with Nativescript and now I wanna make the Web App with the code sharing in between both.


回答1:


I did almost the same a couple of days ago, and while not exactly standard, my approach has been:

  • create a new shared web/mobile project from scratch.
  • move angular components from the mobile-only project to the shared project.
  • rename all HTML files to .tns.html ( probably you should rename SCSS/CSS files too, I didn't have any)
  • create empty HTML files for each component you have added
  • adapt app.module.ts and app.module.tns.ts to include the new components and any service. app.module.tns.ts should very closely resemble the one of the mobile-only app.
  • build and resolve errors when they appear. If possible, keep webpack watch files for both mobile and web build, so that you can resolve errors for both platforms.


来源:https://stackoverflow.com/questions/55194747/how-to-convert-existing-nativescript-angular-project-to-code-sharing-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!