angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Output Path no longer supported on serve?

Open jason-d-hobbs opened this issue 10 years ago • 13 comments

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Windows 10

  1. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.11-webpack.8 node: 6.5.0 os: win32 x64

  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

For the non-webpack betas, I've used this command line to have the compiled output pushed to a specific directory: ng serve --output-path ../.deploy/portfolio.war/ui/ -w -lr -lrp 50000

  1. The log given by the failure. Normally this include a stack trace and some more information.

The option '--output-path' is not registered with the serve command. Run ng serve --help for a list of supported options.

However, ng serve --help says this option is still available: ng serve <options...> Builds and serves your app, rebuilding on file changes. aliases: server, s --port (Number) (Default: 4200) aliases: -p --host (String) Listens on all interfaces by default aliases: -H --proxy (String) aliases: -pr , -pxy --insecure-proxy (Boolean) (Default: false) Set false to proxy self-signed SSL certificates aliases: --inspr --watcher (String) (Default: events) aliases: -w --live-reload (Boolean) (Default: true) aliases: -lr --live-reload-host (String) Defaults to host aliases: -lrh --live-reload-base-url (String) Defaults to baseURL aliases: -lrbu --live-reload-port (Number) (Defaults to port number within [49152...65535]) aliases: -lrp --environment (String) (Default: development) aliases: -e , -dev (--environment=development), -prod (--environment=production) --output-path (Path) (Default: dist/) aliases: -op , -out --ssl (Boolean) (Default: false) --ssl-key (String) (Default: ssl/server.key) --ssl-cert (String) (Default: ssl/server.crt)

  1. Mention any other details that might be useful.

I've been using this at dev time to integrate with an existing web application server (JBoss WildFly). In previous versions, having ng serve push to a directory WildFly is looking for worked perfectly. If this is no longer available, what suggestions are there for a replacement.

Also, it doesn't appear that ng serve is writing to the stated default directory (dist) either. Not sure where the files are going at this point.


Thanks! We'll be in touch soon.

jason-d-hobbs avatar Sep 02 '16 21:09 jason-d-hobbs

i would love to have it back as well

aszechlicki avatar Sep 03 '16 16:09 aszechlicki

Just run ng b && ng s I am not missing it, since it can easily be replaced by above command. To your question: I think that webpack holds the compiled files in memory, so no output directory is needed anyway

ghost avatar Sep 04 '16 13:09 ghost

Thanks, Christian. However, we still need to know if this was a mistake to leave this feature out of the webpack branch, or if it will not be there when 'done'.

Also, I don't think your suggestion will do what I want, as ng s will not update the files written by ng b.

In our scenario, ng b is used for the production build, but during dev time, I need ng s for live reloading, etc. I really need it to update files in a directory though instead of just holding them in RAM.

jason-d-hobbs avatar Sep 06 '16 12:09 jason-d-hobbs

Have you tried ng build --help? This help mentions a --watch <Boolean> flag. Maybe this is what you need. I think that ommiting this is not a bug and will stay as it is, since writing to the disk could slow down webpacks live reload.

I didn't try it, but maybe you could use concurrently. Add a script to your package.json like so: "custom-serve": "concurrently --kill-others \"ng s\" \"ng b --watch true\"" Then instead of ng s, just run npm start custom-serve You could also just open two terminals and run each command in one of those terminals.

ghost avatar Sep 06 '16 13:09 ghost

@christiandreher ng build --watch does only part of what ng serve does - it watches and automatically rebuilds app, but it doesn't reload

aszechlicki avatar Sep 06 '16 13:09 aszechlicki

Thats why I suggested to run ng s and ng b --watch true simultaniously.

ghost avatar Sep 06 '16 13:09 ghost

I'm already using --watch, however I've been using WildFly to actually serve the files from a directory. Before the switch to webpack I could do that (with live reload).

If it will no longer be supported, then I can make other plans. Removing that feature needs to be front and center in the changelog and release notes though. It would also be a bug against the --help feature since it states it's still available.

For the time being I've dropped back to the non-webpack versions until this is resolved one way or the other.

jason-d-hobbs avatar Sep 06 '16 13:09 jason-d-hobbs

build --watch might work out if it would honor the --output-path flag... which was the original issue.

jason-d-hobbs avatar Sep 06 '16 13:09 jason-d-hobbs

Sorry, I don't know what WildFly is and therefore don't exactly know the use case. I just wanted to help somehow. I think that you better wait for a official angular member to answer your question whether it will stay like this or not. I just want to emphasize, that I don't know whether they will remove it or not, it was just a guess.

I also forgot about the exact context of your question, so again sorry for that. You're right, you can't serve from a directory. It seems that it will always serve from a fresh build in-memory.

ghost avatar Sep 06 '16 13:09 ghost

For the purposes of this discussion, just think of it as a webserver with assets beyond what Angular-CLI is providing. Thanks for the feedback. I look forward to a more 'official' answer, too.

jason-d-hobbs avatar Sep 06 '16 13:09 jason-d-hobbs

The --output-path is no longer supported for ng serve, no. We're doing all the serve builds in memory.

ng build --watch is the best option for your usecase.

filipesilva avatar Sep 16 '16 03:09 filipesilva

@filipesilva if the --output-path is no longer supported for ng serve could you please remove this option from ng serve options list in https://github.com/angular/angular-cli/wiki/serve. Thank you!

evgenyfedorenko avatar Jun 15 '17 13:06 evgenyfedorenko

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.