28

When I run ng serve, where are the files generated and stored? I need to troubleshoot why the app works with ng serve but not for production build.

Forgot to mention that I'm using webpack version of angular-cli.

Sam
  • 1,288
  • 1
  • 13
  • 22

2 Answers2

31

With the webpack version the output isn't written to disk. Webpack manages that all in memory and serves it to the browser using the webpack-dev-server.

If you'd like to view the dev output, you will need to run ng build and then look into the dist directory

Brocco
  • 62,737
  • 12
  • 70
  • 76
  • 1
    I think running `ng serve` serves some HTML files directly from my project folder because I notice that `ng build` doesn't include those HTML files I need in the dist folder. Those HTML files are my imports for the Polymer components. It works fine with `ng serve`. – Sam Aug 31 '16 at 19:32
  • Can I customize `ng serve` command? I mean I want to run some bash commands say `node abc.js` before every `ng serve` is it possible? – Pardeep Jain Aug 08 '19 at 11:59
  • can anyone explain which memory? Like there is a tons of memories. Is it RAM? Is it GPU cache? Is it disk memory? If I have 1G Ram memory, how does it manage? Excuse me please, I am this dumb. Help! – Adam Bajger Feb 20 '20 at 21:10
  • 1
    @AdamBajger when anyone says "memory" it's often RAM, specially in programming. – Wiley Marques Apr 20 '20 at 12:04
  • 1
    @WileyMarques apparently it's virtual address space: https://stackoverflow.com/a/20686868/2063755 – David Klempfner Apr 14 '21 at 22:50
3

If your requirement is to have the files on the disk while developing, then use

ng build --configuration development --watch

which will keep and eye out for changes. This will enable you to develop angular by another hosting server (like apache OR your backend application). Note: all configuration related to --configuration development will be available in build section in angular.json file which can be edited as convenient

Devaroop
  • 7,900
  • 2
  • 37
  • 34