Search code examples
angularjsangularproduction-environment

Running an Angular2 app via index.html


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)?


Solution

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