问题
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
andapp.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