The Wayback Machine - https://web.archive.org/web/20200207165709/https://github.com/angular/angular-cli/issues/16572
Skip to content
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

Add documentation for --browser-target #16572

Open
NatoBoram opened this issue Jan 7, 2020 · 4 comments
Open

Add documentation for --browser-target #16572

NatoBoram opened this issue Jan 7, 2020 · 4 comments

Comments

@NatoBoram
Copy link

@NatoBoram NatoBoram commented Jan 7, 2020

📚 Docs or angular.io bug report

Description

There's no documentation for ng serve --browser-target.

🔬 Minimal Reproduction

What's the affected URL?

Reproduction Steps

📷Screenshot

Screen Shot 2020-01-07 at 09 47 16

@NatoBoram

This comment has been minimized.

Copy link
Author

@NatoBoram NatoBoram commented Jan 7, 2020

Woah, that issue template is a pain to work with.

@gkalpak gkalpak transferred this issue from angular/angular Jan 7, 2020
@ngbot ngbot bot added this to the Backlog milestone Jan 7, 2020
@filipesilva

This comment has been minimized.

Copy link
Member

@filipesilva filipesilva commented Jan 9, 2020

Would you like to add more details to this doc? That string is extracted from json files in this repo, and should be the 3 results for "Target to serve" if you search across the code.

@NatoBoram

This comment has been minimized.

Copy link
Author

@NatoBoram NatoBoram commented Jan 10, 2020

I'd love to, but I have no idea what it does nor how to use it. That's why I was referring to the docs.

@filipesilva

This comment has been minimized.

Copy link
Member

@filipesilva filipesilva commented Jan 14, 2020

The browserTarget property says what build target is going to be served. The serve command doesn't completely know how to build it, it just knows how to serve it.

Usually there's only one build, but since a target can have multiple configurations, you can specify that you want to serve that particular configuration of the build. There's some more information about it in this AIO page.

In practical terms what this means is that ng serve will serve the development build and ng serve --prod will serve the production build.

The way this is specified is through browserTarget. In a default angular.json you'll have this:

{
  "projects": {
    "next-app": {
      ...
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": { ... }
          "configurations": {
            "production": { ... }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "next-app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "next-app:build:production"
            }
          }
        },

Where "browserTarget": "next-app:build" means "I want to serve projects->next-app with the default options" and "browserTarget": "next-app:build:production" means "I want to serve projects->next-app with the default options merged with the production config".

Does this description help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.