I have built an Angular 2 app using TS and SystemJS and am running it via the standard "npm start" as shown in the "Tour of Heroes" example on the website. But now I want to upload it for production. So how do I go about converting the application so I can open it via a simple double clicking of the index.html (as in Angular 1.5)?
The easiest way to create simple build is to use angular-cli. https://github.com/angular/angular-cli
One line to build app for production:
ng build --prod
So, if you like it, I would suggest you to do following steps:
1)Create simple angular-cli application and make a test deploy
2)Update angular from rc4 to rc5 (angular-cli uses rc4, but angular tutorial uses rc5). This page will help you https://angular.io/docs/ts/latest/cookbook/rc4-to-rc5.html (if you read this post from future, this step must be outdated)
3)Copy modules you've already developed to this angular-cli application.
Run this
ng build --prod --bh .
This will allow you to double click the index.html
file.
No, you can't. I have tried this with my application but routing was not working for it. Seems it broke somewhere due to angular restrictions. You can able to open static index HTML file only.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.