Description
There is currently no way to serve the site (or run tests) against the result of a previously executed ng build
. This is problematic for a few reasons explained in detail below.
This is a continuation of the discussion started here: #4975
ATTN: @johnpapa / @filipesilva
Motivation
-
Consistency - There are some inconsistencies between
ng serve
and whatng build
places in thedist
folder. For instance,ng serve
serves everything in the root of thesrc
directory which means that static assets can be loaded fromsrc
that will not be available after deployment. -
Debugging - Sometimes it's useful to be able to serve the app exactly as it will be deployed. I've used this when debugging AOT related issues that only present at run-time in a production build. There are other options for this scenario, but running simple http server in the dist folder was the easiest option, but I think ng-cli should be able to use it's included server for this instead of me needing to use another http server.
-
Deployment pipeline - currently my continuous deployment is building the app 3 times. Once each for
ng test
,ng e2e
,ng build
. Ideally I could runng build
then run the tests against the code in the dist folder.