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

docs: Deployment guide for CLI #19839

Merged
merged 1 commit into from Nov 3, 2017
Merged

Conversation

wardbell
Copy link
Contributor

See Issue # 19510

PR Checklist

Please check if your PR fulfills the following requirements:

@mary-poppins
Copy link

You can preview 0306819 at https://pr19839-0306819.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 97dde14 at https://pr19839-97dde14.ngbuilds.io/.


Notice the `paths` key:

For the simplest deployment, build for development and xcopy the output directory to a web server.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xcopy -> copy


### Webpack (and AOT)
The remaining [xcopy deployment steps](#xcopy) are the same as before.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xcopy->copy

Learn more about tree shaking and dead code elmination in
<a href="https://medium.com/@Rich_Harris/tree-shaking-versus-dead-code-elimination-d3765df85c80#.15ih9cyvl" title="Tree-shaking and Dead Code Elimination">
this post</a> by rollup-creator, Rich Harris.
Building for production (or appending the `--environment=prod` flag) enables _production mode_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--environment=prod -> --target=prod

These two are actually different: https://github.com/angular/angular-cli/wiki/build#build-targets-and-environment-files

Copy link
Contributor Author

@wardbell wardbell Oct 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just compared --environment=prod vs --environment=dev and they enable/disable prodMod exactly as I said and expected.

So do --target=production vs --target=development. But the --environment flag is way more intuitive, especially after looking at main.ts

if (environment.production) {
  enableProdMode();
}

Why should I change from --environment to --target? The wiki page is not helping me understand.

Note that I mention --environment here only to talk about enableProd. I'm not talking about any of the other optimizations that would be enabled by --target=production. So I think this text is correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I misunderstood what was being talked about here.

Bundlers don't know about the router configuration and won't create separate bundles for lazy loaded modules.
You have to create these bundles manually.
The CLI **`ng serve`** command builds, watches, and serves the application from a local development server.
Unlike `build`, **it erases the output directory** and serves the build artifacts from memory instead of from files for a faster development experience.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ng build also deletes the directory, it just outputs new files there after.

automatically recognizes lazy loaded `NgModules` and creates separate bundles for them.
If you want to preserve the previously generated files,
append the `-no-delete-output-path` flag to the `serve` command.
Note that the `ng serve` does NOT update generated files as you make changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use ng build --watch to continuously generate files.

@mary-poppins
Copy link

You can preview fd31ace at https://pr19839-fd31ace.ngbuilds.io/.

@@ -482,75 +282,65 @@ The list is by no means exhaustive, but should provide you with a good starting
* [Lite-Server](https://github.com/johnpapa/lite-server): the default dev server installed with the
[Quickstart repo](https://github.com/angular/quickstart) is pre-configured to fallback to `index.html`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will deprecate the quickstart, we shouldn't name it anymore.

@mary-poppins
Copy link

You can preview d64b1fc at https://pr19839-d64b1fc.ngbuilds.io/.

@Foxandxss Foxandxss added this to the 5.0.x milestone Nov 2, 2017
@vicb
Copy link
Contributor

vicb commented Nov 2, 2017

missing:

  • target label
  • merge label
  • green CI

@IgorMinar IgorMinar added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Nov 2, 2017
@IgorMinar
Copy link
Contributor

@vicb the ci failure is a flake and unrelated to this change.

@IgorMinar
Copy link
Contributor

I fixed the labels. @wardbell please always apply "target" and "merge" label when your pr is ready for merge.

@Foxandxss
Copy link
Member

Yes sorry, I have too many PRs and travis is being flaky all day so I go back and forward restarting them and checking all the statuses.

@vicb vicb merged commit 03f080b into angular:master Nov 3, 2017
vicb pushed a commit that referenced this pull request Nov 3, 2017
@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 Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release
Projects
No open projects
docs
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

7 participants