fix(ivy): ngcc - teach Esm5ReflectionHost about aliased variables (#29092)
Sometimes, in ESM5 code, aliases to exported variables are used internally to refer to the exported value. This prevented some analysis from being able to match up a reference to an export to the actual export itself. For example in the following code: ``` var HttpClientXsrfModule = /** @class */ (function () { function HttpClientXsrfModule() { } HttpClientXsrfModule_1 = HttpClientXsrfModule; HttpClientXsrfModule.withOptions = function (options) { if (options === void 0) { options = {}; } return { ngModule: HttpClientXsrfModule_1, providers: [], }; }; var HttpClientXsrfModule_1; HttpClientXsrfModule = HttpClientXsrfModule_1 = tslib_1.__decorate([ NgModule({ providers: [], }) ], HttpClientXsrfModule); return HttpClientXsrfModule; }()); ``` We were not able to tell that the `ngModule: HttpClientXsrfModule_1` property assignment was actually meant to refer to the `function HttpClientXrsfModule()` declaration. This caused the `ModuleWithProviders` processing to fail. This commit ensures that we can compile typings files using the ESM5 format, so we can now update the examples boilerplate tool so that it does not need to compile the ESM2015 format at all. PR Close #29092
This commit is contained in:

committed by
Matias Niemelä

parent
b48d6e1b13
commit
bdcbd9ed4b
@ -68,11 +68,8 @@ class ExampleBoilerPlate {
|
||||
|
||||
if (ivy) {
|
||||
// We only need the "fesm5" bundles as the CLI webpack build does not need
|
||||
// any other formats for building and serving. Ngcc currently only updates
|
||||
// the module typings if we specified an "es2015" format. This means that
|
||||
// we also need to build with "fesm2015" in order to get updated typings
|
||||
// which are needed for compilation.
|
||||
shelljs.exec(`yarn --cwd ${SHARED_PATH} ivy-ngcc --properties module es2015`);
|
||||
// any other formats for building and serving.
|
||||
shelljs.exec(`yarn --cwd ${SHARED_PATH} ivy-ngcc --properties module`);
|
||||
}
|
||||
|
||||
exampleFolders.forEach(exampleFolder => {
|
||||
|
Reference in New Issue
Block a user