4131715df5
Currently if developers use call expressions in their static class members ([like we do in Angular](https://github.com/angular/angular/blob/master/packages/core/src/change_detection/differs/keyvalue_differs.ts#L121)), the metadata that is generated for flat modules is invalid. This is because the metadata bundler logic currently does not handle call expressions in static class members and the symbol references are not rewritten to avoid relative paths in the bundle. Static class members using a call expression are not relevant for the ViewEngine AOT compilation, but it is problematic that the bundled metadata references modules using their original relative path. This means that the bundled metadata is no longer encapsulated and depends on other emitted files to be emitted in the proper place. These incorrect relative paths can now cause issues where NGC looks for the referenced symbols in the incorrect path. e.g. ``` src/ | lib/ | index.ts -> References the call expression using `../../di` ``` Now the metadata looks like that: ``` node_modules/ | @angular/ -- | core/ -- -- | core.metadata.json -> Says that the call expr. is in `../../di`. | di/ ``` Now if NGC tries to use the metadata files and create the summary files, NGC resolves the call expression to the `node_modules/di` module. Since the "unexpected" module does not contain the desired symbol, NGC will error out. We should fix this by ensuring that we don't ship corrupted metadata to NPM which contains relative references that can cause such failures (other imports can be affected as well; it depends on what modules the developer has installed and how we import our call expressions). Fixes #28741. PR Close #28762 |
||
---|---|---|
.. | ||
BUILD.bazel | ||
bundler_spec.ts | ||
collector_spec.ts | ||
evaluator_spec.ts | ||
index_writer_spec.ts | ||
symbols_spec.ts | ||
typescript.mocks.ts |