Skip to content

ng serve deletes /dist directory #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
luke88jones opened this issue May 5, 2017 · 3 comments
Closed

ng serve deletes /dist directory #73

luke88jones opened this issue May 5, 2017 · 3 comments

Comments

@luke88jones
Copy link

Hello,

I believe there is an issue with the current configuration when running npm run start. A recent change to ng serve made it delete the ./dist directory. This is now causing the server to fail to start as its failing to locate the www.js file.

image

This is occurring on Windows

@stephenlane
Copy link

I get similar issue, just keep running the npm run start command and it will eventually work :)

@avbentem
Copy link

Just for future reference: deleting the dist folder is done since Angular CLI's angular/angular-cli#4293

@avbentem
Copy link

It seems that just changing the order in concurrently indeed lowers the chances of this happening, but does not always fix it.

However, since 1.1.0-rc.0 ng serve also supports --delete-output-path=false, which suppresses deletion of dist:

"start": "concurrently --kill-others \"ng serve --delete-output-path=false --aot=true --progress=false --proxy-config proxy.conf.json\" \"npm run _server:run\""

Alternatively, to get some implicit documentation, one could use some verbose --output-path=dummy-to-preserve-dist-folder on the command line of ng serve, which will then delete the ./dummy-to-preserve-dist-folder folder if that would exist, but above all leave dist alone.

Both tested on OS X.

As an aside, instead of calling tsc twice and using concurrently in:

"_server:run": "tsc -p ./server && concurrently \"tsc -w -p ./server\" \"nodemon dist/server/bin/www.js\" "

...I am using https://www.npmjs.com/package/tsc-watch The above makes tsc -w always trigger yet another compilation, which makes nodemon log [nodemon] restarting due to changes... a few times upon starting. Using tsc-watch avoids that:

"_server:run": "tsc-watch -p ./server --onSuccess \"nodemon dist/server/bin/www.js\""

(Thanks for a nice starter!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants