angular/packages/compiler-cli/linker/babel
JoostK 0b867e83b6 fix(compiler-cli): insert constant statements after the first group of imports (#56431)
The linker inserts the constant statements that are needed to support compiled templates
after the import statements of an ESM file, but it failed to account for import statements
that are not at the top of the file. This is typically seen in FESM files where multiple
individual ESMs have been concatenated into a single ESM file, with imports in various places.
The linker would then find the very last import statement to insert the constant statements
after, but this may result in TDZ errors for component templates that have been emitted
earlier in the file.

This commit updates the Babel linker plugin to insert constant statements after the last
import of the first import group, therefore avoiding the TDZ error.

Fixes #56403

PR Close #56431
2024-06-13 10:15:00 -07:00
..
src fix(compiler-cli): insert constant statements after the first group of imports (#56431) 2024-06-13 10:15:00 -07:00
test fix(compiler-cli): insert constant statements after the first group of imports (#56431) 2024-06-13 10:15:00 -07:00
BUILD.bazel refactor: reduce direct babel dependencies (#53441) 2023-12-08 14:33:59 -08:00
index.ts fix(compiler-cli): expose the linker as a Babel plugin (#41918) 2021-05-04 12:43:00 -07:00
README.md refactor(compiler-cli): linker - add Babel plugin, FileLinker and initial PartialLinkers (#39116) 2020-10-19 11:23:45 -07:00

Angular linker - Babel plugin

This package contains a Babel plugin that can be used to find and link partially compiled declarations in library source code. See the linker package README for more information.

Unit Testing

The unit tests are built and run using Bazel:

yarn bazel test //packages/compiler-cli/linker/babel/test