Title: NGCC async mode master issue · Issue #35717 · angular/angular · GitHub
Open Graph Title: NGCC async mode master issue · Issue #35717 · angular/angular
X Title: NGCC async mode master issue · Issue #35717 · angular/angular
Description: This is a master issue of issues/improvements needed for NGCC async mode to be more successful with the CLI integration. Allow termination (CTRL+C) - Currently it is not possible to terminate NGCC async process. Clustering issue - Fork c...
Open Graph Description: This is a master issue of issues/improvements needed for NGCC async mode to be more successful with the CLI integration. Allow termination (CTRL+C) - Currently it is not possible to terminate NGCC ...
X Description: This is a master issue of issues/improvements needed for NGCC async mode to be more successful with the CLI integration. Allow termination (CTRL+C) - Currently it is not possible to terminate NGCC ...
Opengraph URL: https://github.com/angular/angular/issues/35717
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NGCC async mode master issue","articleBody":"This is a master issue of issues/improvements needed for NGCC async mode to be more successful with the CLI integration.\r\n\r\n1) Allow termination (CTRL+C) - Currently it is not possible to terminate NGCC async process. \r\n2) Clustering issue - Fork clustering without properly setting up the master is not ideal when used via the API. More context in: TOOL-1339 (Can be solved by using `cluster.setupMaster`)\r\n3) Unable to provide a custom logger. As a workaround and interim for the issue 2. In the CLI we will most likely setup the cluster master ourselves in the webpack plugin. However with this approach we cannot use a custom logger\r\n\r\n```ts\r\ncluster.setupMaster({\r\n exec: require.resolve('@angular/compiler-cli/ngcc/main-ngcc.js'),\r\n args: [\r\n '--basePath',\r\n this._nodeModulesDirectory,\r\n '--propertiesToConsider',\r\n ...this.propertiesToConsider,\r\n '--compileAllFormats',\r\n 'false',\r\n '--async',\r\n ],\r\n});\r\n```\r\n3) Reduce worker code path - Reduce workers by pointing the cluster workers to start from a different entrypoint (Can use `cluster.setupMaster()`), this should speed up the worker boot time.\r\n4) ~~Don't spawn unneeded workers - Spawning workers is expensive and currently we are spawning unwanted workers, when 1, there are no packages to process, 2, when we need to process a number of packages which is less than the available CPU count - 1~~. Addressed in #35719\r\n5) Running the new integration NGCC async as opposed to NGCC sync during module resolution causes a build time regression of 8/10 seconds on an `ng new` application with Angular Material when all modules have been processed previously. (Seems to be related to `analyzeEntryPoints`) Note: in my app I am importing all material entrypoints. \r\n```ts\r\nimport { BrowserModule } from '@angular/platform-browser';\r\nimport { NgModule } from '@angular/core';\r\n\r\nimport { AppRoutingModule } from './app-routing.module';\r\nimport { AppComponent } from './app.component';\r\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\r\n\r\n\r\nimport { MatExpansionModule } from '@angular/material/expansion';\r\nimport { MatGridListModule } from '@angular/material/grid-list';\r\nimport { MatTreeModule } from '@angular/material/tree';\r\nimport { MatBottomSheetModule } from '@angular/material/bottom-sheet';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\r\nimport { MatCardModule } from '@angular/material/card';\r\nimport { MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { MatDialogModule } from '@angular/material/dialog';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatSortModule } from '@angular/material/sort';\r\nimport { MatTabsModule } from '@angular/material/tabs';\r\nimport { MatSliderModule } from '@angular/material/slider';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\nimport { MatDividerModule } from '@angular/material/divider';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatBadgeModule } from '@angular/material/badge';\r\nimport { MatSidenavModule } from '@angular/material/sidenav';\r\nimport { MatMenuModule } from '@angular/material/menu';\r\nimport { MatRadioModule } from '@angular/material/radio';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { MatSnackBarModule } from '@angular/material/snack-bar';\r\nimport { MatStepperModule } from '@angular/material/stepper';\r\nimport { MatChipsModule } from '@angular/material/chips';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport { MatPaginatorModule } from '@angular/material/paginator';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatDatepickerModule } from '@angular/material/datepicker';\r\n\r\n@NgModule({\r\n declarations: [\r\n AppComponent\r\n ],\r\n imports: [\r\n BrowserModule,\r\n AppRoutingModule,\r\n BrowserAnimationsModule,\r\n MatExpansionModule,\r\n MatGridListModule,\r\n MatTreeModule,\r\n MatBottomSheetModule,\r\n MatButtonModule,\r\n MatButtonToggleModule,\r\n MatCardModule,\r\n MatCheckboxModule,\r\n MatToolbarModule,\r\n MatDialogModule,\r\n MatIconModule,\r\n MatSortModule,\r\n MatTabsModule,\r\n MatSliderModule,\r\n MatSlideToggleModule,\r\n MatDividerModule,\r\n MatFormFieldModule,\r\n MatBadgeModule,\r\n MatSidenavModule,\r\n MatMenuModule,\r\n MatRadioModule,\r\n MatTooltipModule,\r\n MatProgressSpinnerModule,\r\n MatProgressBarModule,\r\n MatSelectModule,\r\n MatListModule,\r\n MatSnackBarModule,\r\n MatStepperModule,\r\n MatChipsModule,\r\n MatAutocompleteModule,\r\n MatPaginatorModule,\r\n MatInputModule,\r\n MatDatepickerModule\r\n ],\r\n providers: [],\r\n bootstrap: [AppComponent]\r\n})\r\nexport class AppModule { }\r\n```\r\n\r\n6. NGCC Aync will process known packages that we know that they are not compiled using Angular. for instance `@babel/`, `@rollup/`, `postcss-`, `@webassemblyjs` just these amount to approximately 200 packages. While we can add these to the internal NGCC config https://github.com/angular/angular/blob/3cc812711bfcf27feadf4227f5664d6044e3769f/packages/compiler-cli/ngcc/src/packages/configuration.ts#L85-L105 it seems that there are still a lot of IO operations for these packages. Due to the following logic; https://github.com/angular/angular/blob/3cc812711bfcf27feadf4227f5664d6044e3769f/packages/compiler-cli/ngcc/src/entry_point_finder/directory_walker_entry_point_finder.ts#L44-L73\r\n\r\nWhen an entrypoint is ignored the `entryPoints.length` will be `0` and we fallback to the code path of reading it's sub directories.\r\n\r\n7) We are traversing sub node_modules of dependencies that are not Angular packages. - We shouldn't try to process node_modules if the parent is not an Angular library. It is unlikely that an non Angular library has Angular dependencies. Addressed by #35756\r\n\r\n8) NGCC keep traversing the sub directory tree to find sub entry points, when the parent is not an entrypoint. Addressed by #35756\r\n\r\nExample: \r\n```\r\nreaddir /node_modules/@schematics/angular -> This contains a `package.json`\r\nreaddir /node_modules/@schematics/angular/module -> This doesn't contain a `package.json` we should bail\r\nreaddir /node_modules/@schematics/angular/module/files\r\nreaddir /node_modules/@schematics/angular/module/files/__name@dasherize@if-flat__\r\n```\r\n\r\n//cc @gkalpak & @petebacondarwin","author":{"url":"https://github.com/alan-agius4","@type":"Person","name":"alan-agius4"},"datePublished":"2020-02-27T12:05:58Z","url":"https://github.com/angular/angular/issues/35717"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0fc1a1a3-1f63-b03c-8b83-e669416681e5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 93A6:172B92:15ED76B:1D452AF:6B013975 |
| html-safe-nonce | e744ed32a5dc1d416917f4ac93daaceb2d5aadc6fbaf59408071657706349822 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5M0E2OjE3MkI5MjoxNUVENzZCOjFENDUyQUY6NkIwMTM5NzUiLCJ2aXNpdG9yX2lkIjoiMTcwNTk5NTUxNjUxMTAxMDQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c8f41d1766badde021872df715af74e91540d7bafefa89192afbfe7e88b8d761 |
| hovercard-subject-tag | issue:572037836 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/35717/issue_layout |
| twitter:image | https://opengraph.githubassets.com/715d98f5363d9d00b6e2a32716db0f2e66bae10ebb0156745c078b97b6badb34/angular/angular/issues/35717 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/715d98f5363d9d00b6e2a32716db0f2e66bae10ebb0156745c078b97b6badb34/angular/angular/issues/35717 |
| og:image:alt | This is a master issue of issues/improvements needed for NGCC async mode to be more successful with the CLI integration. Allow termination (CTRL+C) - Currently it is not possible to terminate NGCC ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alan-agius4 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width