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)?
-
1you need to provide a lot more information for anyone to give you an answer on this... Did you start with a seed project? Are you using webpack? SystemJS? Gulp?cport1– cport12016-09-02 21:11:35 +00:00Commented Sep 2, 2016 at 21:11
-
Yeah I started with the seed in the Angular 2 website using SystemJS.mrinalmech– mrinalmech2016-09-02 21:31:14 +00:00Commented Sep 2, 2016 at 21:31
-
you cant. the back end serve the index.html after handling routes, you need to run your application from the command line unless you are using some sort of GUIMark Acosta– Mark Acosta2016-09-03 04:55:30 +00:00Commented Sep 3, 2016 at 4:55
3 Answers
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.