ngcc may need to insert public exports into the bundle's source as well as to the entry-point's declaration file, as the Ivy compiler may need to create import statements to internal library types. The way ngcc knows which exports to add is through the references registry, to which references to things that require a public export are added by the various analysis steps that are executed. One of these analysis steps is the augmentation of declaration files where functions that return `ModuleWithProviders` are updated so that a generic type argument is added that corresponds with the `NgModule` that is actually imported. This type has to be publicly exported, so the analyzer step has to add the module type to the references registry. A problem occurs when `ModuleWithProviders` already has a generic type argument, in which case no update of the declaration file is necessary. This may happen when 1) ngcc is processing additional bundle formats, so that the declaration file has already been updated while processing the first bundle format, or 2) when a package is processed which already contains the generic type in its source. In both scenarios it may occur that the referenced `NgModule` type does not yet have a public export, so it is crucial that a reference to the type is added to the references registry, which ngcc failed to do. This commit fixes the issue by always adding the referenced `NgModule` type to the references registry, so that a public export will always be created if necessary. Resolves FW-1575 PR Close #32902
Angular Compatibility Compiler (ngcc)
This compiler will convert node_modules
compiled with ngc
, into node_modules
which
appear to have been compiled with ngtsc
.
This conversion will allow such "legacy" packages to be used by the Ivy rendering engine.
Building
The project is built using Bazel:
yarn bazel build //packages/compiler-cli/ngcc
Unit Testing
The unit tests are built and run using Bazel:
yarn bazel test //packages/compiler-cli/ngcc/test
Integration Testing
There are tests that check the behavior of the overall executable:
yarn bazel test //packages/compiler-cli/ngcc/test:integration