mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
ngcc currently dynamially loads the `Transformer` code. It does this to avoid unnecessary parsing and loading of transformer-related code if there is nothing to process (so-called noop case). Unfortunately this dynamic require is not recognized by ESBuild. The import needs to be discovered as otheriwse the transformer code would not be included in the bundled package output of the CLI. The ngcc code needs to use an async runtime import as it would work in ES modules. This introduces async code into to the compililation pipeline, breaking the `ngccMain` synchronous invocation feature. To avoid this, we just move the dynamic require/async import to the file top-level so that we do not break synchronous processing which the CLI relies on. This has the downside of slowing-down the noop case a little but I believe that should be mitigated through bundling of ngcc anyway. In the future with full-ESM we won't be able to get around this anyway (unless we remove the sync variant of ngcc processing). PR Close #43431 |
||
|---|---|---|
| .. | ||
| lockfile_with_child_process | ||
| async_locker_spec.ts | ||
| sync_locker_spec.ts | ||