angular/packages/compiler-cli/ngcc/test/locking
Paul Gschwendtner 11a81898be refactor(compiler-cli): remove dynamic require in ngcc to allow for bundling (#43431)
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
2021-10-01 18:28:43 +00:00
..
lockfile_with_child_process refactor(compiler-cli): remove dynamic require in ngcc to allow for bundling (#43431) 2021-10-01 18:28:43 +00:00
async_locker_spec.ts Revert "perf(ngcc): allow immediately reporting a stale lock file (#37250)" (#39435) 2020-10-27 13:36:27 -07:00
sync_locker_spec.ts fix(compiler-cli): ngcc - remove outdated link (#40285) 2021-01-06 07:10:39 -08:00