Skip to content

Add documentation for --browser-target #16572

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
NatoBoram opened this issue Jan 7, 2020 · 10 comments · Fixed by #19474
Closed

Add documentation for --browser-target #16572

NatoBoram opened this issue Jan 7, 2020 · 10 comments · Fixed by #19474
Labels
area: @angular-devkit/build-angular area: docs Related to the documentation freq1: low Only reported by a handful of users who observe it rarely good first issue help wanted severity1: confusing
Milestone

Comments

@NatoBoram
Copy link

📚 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
Copy link
Author

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
@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely good first issue help wanted labels Jan 8, 2020
@filipesilva
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

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?

@domthewop
Copy link

@NatoBoram I have some spare cycles if you'd like to hand this off. Alternatively, I'd be happy to collaborate instead if you'd still like to be involved. I wrote some of the Python docs, and would be happy to mentor. And, of course, happy to let you do your thing -- but please update us either way.

@NatoBoram
Copy link
Author

@domthewop You're free to work on it :)

@rrohak
Copy link

rrohak commented Jun 19, 2020

Is this still up for grabs?

@domthewop
Copy link

Go for it, @rrohak -- I left Google in the interim and didn't update the ticket, sorry!

@rrohak
Copy link

rrohak commented Jun 19, 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.

Here you said there are 3 results but IntelliJ only shows 2, are we including serve.md under docs/documentation or am I missing another file? @filipesilva
image

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular-devkit/build-angular area: docs Related to the documentation freq1: low Only reported by a handful of users who observe it rarely good first issue help wanted severity1: confusing
Projects
None yet
7 participants
@domthewop @filipesilva @NatoBoram @alan-agius4 @clydin @rrohak and others