Deliver web apps with confidence 🚀
Find a file
Payam Valadkhan 3263df23f2 feat(compiler-cli): generate global imports in local compilation mode (#53543)
With option `generateExtraImportsInLocalMode` set in local compilation mode, the compiler generates extra side effect imports using this rule: any external module from which an identifier is imported into an NgModule will be added as side effect import to every file in the compilation unit. To illustrate this better assume the compilation unit has source files `a.ts` and `b.ts`, and:

```
// a.ts
import {SomeExternalStuff} from 'path/to/some_where';
import {SomeExternalStuff2} from 'path/to/some_where2';

...

@NgModule({imports: [SomeExternalStuff]})

```

then the extra import `import "path/to/some_where"` will be added to both `a.js` and `b.js`. Note that this is not the case for `import "path/to/some_where2"` though, since the symbol `SomeExternalStuff2` is not imported into any NgModule.

The math behind this mechanism is, in local compilation mode we cannot resolve component external dependencies fully. For example if a component in `a.ts` uses an external component defined in an external file `some_external_comp.ts` then we can generate the import to this file in `a.js`. Instead, we want to generate an import to a file that "gurantees" that `a.js` is placed after `some_external_comp.js` in the bundle. Now since the component in  `some_external_comp.ts` is used in `a.ts`, then there must be a chain of imports starting from the NgModule that declares the component in `a.ts` to the component in `some_external_comp.ts`. This chain means some file in the same compilation unit as `a.ts` should import some external NgModule which includes `some_external_comp.ts` in its transitive closure and import it to some NgModule. So by adding this import to `a.js` we ensure that the bundling will have the right order.

PR Close #53543
2024-01-30 15:05:43 +00:00
.circleci ci: migrate snapshot publishing from CircleCI to GHA (#51957) 2023-10-05 10:53:22 -07:00
.devcontainer build: upgrade node version for .devcontainer example file (#53157) 2023-11-27 15:49:35 +01:00
.github build: ensure zone.js typing test is hermetic (#54048) 2024-01-24 14:57:05 +01:00
.husky build: remove unnecessary husky gitignore file (#42870) 2021-07-19 17:31:55 -07:00
.ng-dev refactor: migrate bazel, benchpress, elements and misc to prettier formatting (#53995) 2024-01-22 09:07:15 +01:00
.vscode docs: minor update to modify the Bazel extension url (#51925) 2023-09-27 09:21:33 -07:00
.yarn build: update yarn (#50732) 2023-06-16 10:51:09 +02:00
adev feat(common): add placeholder to NgOptimizedImage (#53783) 2024-01-29 16:00:38 +00:00
aio docs: Update component-overview.md (#52282) 2024-01-29 19:30:59 +00:00
devtools refactor(devtools): migrate to standalone (#53998) 2024-01-23 09:53:24 +01:00
docs docs: clarify Node.js version (#53581) 2023-12-18 15:33:40 +00:00
goldens refactor(compiler-cli): incorporate LocalCompilationExtraImportsTracker in the compilation workflow (#53543) 2024-01-30 15:05:42 +00:00
integration feat(core): expose new input API for signal-based inputs (#53872) 2024-01-10 12:33:31 -08:00
modules refactor: migrate modules to prettier formatting (#53954) 2024-01-17 09:41:59 -08:00
packages feat(compiler-cli): generate global imports in local compilation mode (#53543) 2024-01-30 15:05:43 +00:00
scripts refactor: migrate scripts to prettier formatting (#53976) 2024-01-19 10:22:06 +01:00
third_party build: create NodeJS ESM loader for supporting Bazel setup (#48521) 2022-12-19 19:50:40 +00:00
tools docs: Corrected link for defer related blocks (#52704) 2024-01-26 20:38:36 +00:00
.bazelignore test: add integration test for signal inputs in CLI (#53808) 2024-01-10 12:21:05 +00:00
.bazelrc build: migrate project_id option to use bes_instance_name (#51696) 2023-09-07 13:49:07 -07:00
.bazelversion build: update to bazel v5 for new runfiles API used in dev-infra (#45407) 2022-03-21 16:55:36 -07:00
.clang-format feat(tooling): Add a .clang-format for automated JavaScript formatting. 2015-04-02 08:44:34 -07:00
.editorconfig build: use https link to editorconfig.org in .editorconfig (#27664) 2018-12-18 09:30:09 -08:00
.gitattributes build: cleanup .gitattributes file and remove outdated CRLF attribute (#46513) 2022-06-28 13:38:27 -07:00
.gitignore refactor(docs-infra): refactor adev to build using architect (#53497) 2023-12-11 19:21:07 +00:00
.gitmessage build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00
.mailmap build: add a Git .mailmap with my new name (#19550) 2017-10-09 14:35:30 -07:00
.npmrc build: rely on engines to prevent using npm for dependency install (#41477) 2021-04-07 12:05:01 -07:00
.nvmrc build: migrate to node 18 (#51609) 2023-09-01 15:12:43 +00:00
.prettierrc ci: use prettier to format yml files (#42136) 2021-05-19 11:20:20 -07:00
.pullapprove.yml ci: adding devversion to reviewers for compiler/core (#54053) 2024-01-26 19:10:56 +00:00
.yarnrc build: update yarn (#50732) 2023-06-16 10:51:09 +02:00
browser-providers.conf.d.ts build: share Saucelabs browsers between karma test targets using background Saucelabs daemon and custom karma launcher (#49200) 2023-05-15 09:21:46 -07:00
browser-providers.conf.js ci: enable Android 12 for tests on CI (#45926) 2022-05-09 11:26:10 -07:00
BUILD.bazel refactor(docs-infra): refactor adev to build using architect (#53497) 2023-12-11 19:21:07 +00:00
CHANGELOG.md docs(changelog): release notes, fix the typos etc (#52628) 2024-01-26 20:38:05 +00:00
CHANGELOG_ARCHIVE.md docs: fix typos 2023-06-22 12:56:49 +02:00
CODE_OF_CONDUCT.md build: update CODE_OF_CONDUCT.md to match the content of angular/.github 2023-03-13 21:07:51 +00:00
CONTRIBUTING.md docs: Fix misspelling in note of git commit --all (#51735) 2023-09-12 12:25:42 -07:00
gulpfile.js build: remove the unused source-map-test (#46518) 2022-06-27 15:42:43 -07:00
karma-js.conf.js build: share Saucelabs browsers between karma test targets using background Saucelabs daemon and custom karma launcher (#49200) 2023-05-15 09:21:46 -07:00
LICENSE build: bump license year (#49984) 2023-04-25 09:29:16 -07:00
package.json refactor(router): Update integration tests to cover navigation and history API (#53799) 2024-01-30 15:04:02 +00:00
packages.bzl refactor(docs-infra): build adev application using local generated assets (#53511) 2023-12-20 14:49:31 -08:00
README.md docs: add documentation and script for local docs dev environment (#54038) 2024-01-25 18:02:27 +00:00
renovate.json ci: update renovate.json (#49909) 2023-04-18 20:54:28 +00:00
SECURITY.md build: update SECURITY.md to match the content of angular/.github 2023-01-06 08:51:29 +00:00
tsconfig-tslint.json refactor(devtools): run ng-dev format on angular devtools files 2022-01-26 16:35:30 -05:00
tslint.json build: configure tslint to ban performance.mark usages (#52505) 2023-11-03 07:43:36 -07:00
WORKSPACE build: configure cross-pkg resolution for api extraction (#52499) 2024-01-05 11:27:34 -08:00
yarn.bzl build: update yarn (#50732) 2023-06-16 10:51:09 +02:00
yarn.lock refactor(compiler): extract call and construct signatures of interfaces (#54053) 2024-01-26 19:10:56 +00:00
yarn.lock.readme.md build: clean up references to old master branch (#45856) 2022-05-04 16:23:33 -07:00

Angular - The modern web developer's platform

angular-logo
Angular is a development platform for building mobile and desktop web applications
using TypeScript/JavaScript and other languages.

angular.dev

Contributing Guidelines · Submit an Issue · Blog

CI status   Angular on npm   Discord conversation

InsightsSnapshot


Documentation

Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.

Advanced

Local Development

To contribute to Angular docs, you can setup a local environment with the following commands:

# Clone Angular repo
git clone https://github.com/angular/angular.git

# Navigate to project directory
cd angular

# Install dependencies
yarn

# Build and run local dev server
# Note: Initial build will take some time
yarn docs

Development Setup

Prerequisites

Setting Up a Project

Install the Angular CLI globally:

npm install -g @angular/cli

Create workspace:

ng new [PROJECT NAME]

Run the application:

cd [PROJECT NAME]
ng serve

Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.

Quickstart

Get started in 5 minutes.

Ecosystem

angular ecosystem logos

Changelog

Learn about the latest improvements.

Upgrading

Check out our upgrade guide to find out the best way to upgrade your project.

Contributing

Contributing Guidelines

Read through our contributing guidelines to learn about our submission process, coding rules, and more.

Want to Help?

Want to report a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.

Code of Conduct

Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.

Community

Join the conversation and help the community.

Love Angular badge

Love Angular? Give our repo a star ⬆️.