Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does `ng serve` output files to?

Tags:

angular-cli

ng serve is not building to the path that I have set in my angular-cli.json in apps[0].outDir.

ng build works correctly and builds to the path that I have specified.

like image 205
Daniel Patrick Avatar asked Oct 17 '16 13:10

Daniel Patrick


People also ask

How does ng serve work?

ng serve is a great command to use when developing your application locally. It starts up a local development server, which will serve your application while you are developing it. It is not meant to be used for a production environment.

What folder is NG serve?

ng serve. To get the application running, the ng serve command must execute within the [name-of-app] folder. Anywhere within the folder will do.

How do you end ng serve?

Try using ctrl + c twice to get the prompt for terminating the batch job. If you cannot see the "ng serve" command running, then you can do the following on Mac OSX (This should work on any Linux and Uni software as well).

What command would you use to build and serve your app automatically opening a new browser window?

In your browser, open http://localhost:4200/ to see the new application run. When you use the ng serve command to build an application and serve it locally, the server automatically rebuilds the application and reloads the page when you change any of the source files.


1 Answers

It's correct that ng serve builds in memory.

Angular CLI does not have support for running a server and writing to disk at the same time.

If you are using your own server, etc., you can use ng build --watch, which will watch files just like ng serve, but will write them to disk, and will not run a server.

Check this official documentation on how to serve files from disk:
https://github.com/angular/angular-cli/wiki/stories-disk-serve

like image 183
Meligy Avatar answered Oct 25 '22 14:10

Meligy