19
votes

I initially started a project with beta 10 of the angular-cli, when I run ng serve at that point of time the dist folder would contain the compiled files that were generated by ng serve.

Now I upgraded my app to RC5 and beta 11.webpack of the angular-cli and ng serve doesn't generate the dist folder anymore. This is problematic because I have a Spring Boot backend which is configured to map the dist folder as it's static folder.

Is there a way to get this behaviour with the webpack angular-cli as well?

Exact version of angular-cli is: 1.0.0-beta.11-webpack.2

Edit: the point is that I need the auto compile from ng serve, I don't want to run ng build every time I make a change in the source files.

4
Try: $ rm -rf dist tmp node_modules && npm install && ng build - narainsagar
I edited the question, ng build generates a dist folder just fine, that is not the problem. Earlier ng serve also generated the dist folder. This is not the case anymore. I want that behaviour back. - Tim

4 Answers

21
votes

Just use ng build --watch. It will be rebuilding the project on changes.

23
votes

The new angular-cli version with webpack will generate dist folder only after ng build.

ng serve works only in-memory now.

7
votes

In the root folder of your angular2 project, run:

ng build

Or for production:

ng build --prod

This command will generate the dist folder.

0
votes

In the root folder of your project run

ng serve --delete-output-path=false

or

ng serve --no-delete-output-path

This worked for me.