Angular-cli: Output dist directory for ng serve

Created on 3 Feb 2017  路  16Comments  路  Source: angular/angular-cli

I'm submitting a feature request

I'm wondering if it's applicable to introduce an optional flag for ng serve to output dist directory.
Using this flag along with the Proxy To Backend feature will support dev environment for whom are using the CLI within an external server such as IIS and Apache

Related issue #4271

Most helpful comment

@MurhafSousli You edited your original comment, and it wasn't clear.

What you're really looking for is ng build --watch, which outputs dist/ and will update it when files change.

All 16 comments

This is by design, and you should never use ng serve for anything other than development. It's not performant and it's not secure.

@hansl did you understand my request?! I said I want to use ng serve for development!! why did you close it?

Tell me where did I mention PRODUCTION, I said I need the dist directory, because APACHI or IIS needs to load the angular app from there FOR LOCAL DEVELOPMENT ONLY

@MurhafSousli, if you're needing the dist directory, just use ng build --dev. I don't see what benefits serve gives you if you're using IIS or Apache in front of you app.

You might want to throw in --watch aswell to rebuild on changes.

@delasteve How do you do live reload with ng build --dev ?

@MurhafSousli You edited your original comment, and it wasn't clear.

What you're really looking for is ng build --watch, which outputs dist/ and will update it when files change.

@hansl yes I changed support serve environment to support dev environment, still same meaning

Livereload is part of webpack-dev-server and is not something you'll get access to if you're using IIS or apache. As stated before you can use --watch to rebuild on change. But you'll still ned to manually refresh the page to see changes.

@grizzm0 Check the Proxy To Backend.

I'd vote for MurhafSousli's request aswell. It is needed if you use ng serve for hot-reloading dev with some backend like iis.
I use a config where my Prod server routes to /dist for example for some images or other assets, accessed via proxy to backend. [ request /img/img.jpg gets /dist/img/img.jpg ]
Now during development, /dist is missing with the new beta, so are my images etc. . I use a workaround telling my dev-backendserver to route to /src during dev, that works while src & dist have the same folder / file structure, but get's complicated if not. Life would be so much easier if one could use ng serve with a optional dist folder!

ng serve uses webpack-dev-server which serves the content from memory.

@grizzm0 we know that, but can you tell where does it serve the content from when ng serve --aot is used?

Its still being served from memory. That's how webpack-dev-server works.

I hope ng build --bh "./" --watch works for chrome extension development.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings