mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Removes the remaining usages of dynamic require statements in the package output. Since we declare all shipped packages as strict ESM, we cannot use dynamic require statements anymore. This commit switches these usages to actual `import` statements. Note: Tsickle continues to remain an optional dependency since bundling does not work with its UMD package output. Also tsickle is rarely used by consumers, if at all, so bundling does not really provide any significant value. To continue keeping tsickle optional (since it's still needed by the `annotateForClosureCompiler` option which is also respected in ngtsc), we pass-through a tsickle instance as a parameter to `main`. This allows us to keep the compile functions synchronous without having to refactor the majority of the watch compilation code, and majority of tests for ngc, ngtsc. Consumers (like the `ngc` bin entry-point) can then load tsickle based on their module format. e.g. tsickle can be imported through `require` to keep everything sync, but in ESM, the dynamic import can be used beforehand to pass `tsickle` to the `main` function. We can revisit this in the future but for now this does the trick without exceeding the scope of this commit.. PR Close #43431 |
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| BUILD.bazel | ||
| index.ts | ||
| main-ngcc.ts | ||
| README.md | ||
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