1

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

3
  • 1
    you 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? Commented Sep 2, 2016 at 21:11
  • Yeah I started with the seed in the Angular 2 website using SystemJS. Commented 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 GUI Commented Sep 3, 2016 at 4:55

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

Run this

ng build --prod --bh .

This will allow you to double click the index.html file.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.