Reputation: 764
I have Angular 2 SPA site.
I want to run e2e tests in the Teamcity.
I want to know how to build and run the the site on live server without a watch. ng serve
builds, runs and watch the live site which causes issues in the Teamcity (console remains open)
I would like to run it in localhost as ng serve
command does without watch option
Upvotes: 0
Views: 6745
Reputation: 15353
With angular-cli:
ng build -p
will build your app for production.
ng build -p --aot
will build your app for production and use the Ahead Of Time compiler for a lighter app.
Upvotes: 0
Reputation: 9116
Within your terminal, cd
into your Angular 2 project folder. Run ng build --prod
to compile your sources. This command will generate a dist
directory within your project's root directory, this is the only folder that you will need to have your Angular 2 project running in production. If you are using NGINX, you can set-up a domain to point to this directory and have the index.html
file as it's index. You will also need to redirect all sub-URLs to the index.html as Angular 2 will handle the 404s. Similar concept if you are using Apache.
Upvotes: 0
Reputation: 16917
ng build --prod
will build and bundle everything into the dist
-folder.
You can host that content on any webserver.
Upvotes: 1