fix(ivy): ngcc - properly handle aliased class expressions#29119
fix(ivy): ngcc - properly handle aliased class expressions#29119JoostK wants to merge 9 commits intoangular:masterfrom
Conversation
c1d6dd3 to
f5500e3
Compare
c9a86e7 to
048f8de
Compare
048f8de to
058c618
Compare
60ed31e to
bf90f0d
Compare
987afdf to
05570ec
Compare
In ES2015, classes could have been emitted as a variable declaration initialized with a class expression. In certain situations, an intermediary variable suffixed with `_1` is present such that the variable declaration's initializer becomes a binary expression with its rhs being the class expression, and its lhs being the identifier of the intermediate variable. This structure was not recognized, resulting in such classes not being considered as a class in `Esm2015ReflectionHost`. As a consequence, the analysis of functions/methods that return a `ModuleWithProviders` object did not take the methods of such classes into account. Another edge-case with such intermediate variable was that static properties would not be considered as class members. A testcase was added to prevent regressions. Fixes #29078 PR Close #29119
In a770aa2 ngcc was moved up one folder, however the angular-robot config was not updated to reflect this change. PR Close angular#29119
…9119) In ES2015, classes could have been emitted as a variable declaration initialized with a class expression. In certain situations, an intermediary variable suffixed with `_1` is present such that the variable declaration's initializer becomes a binary expression with its rhs being the class expression, and its lhs being the identifier of the intermediate variable. This structure was not recognized, resulting in such classes not being considered as a class in `Esm2015ReflectionHost`. As a consequence, the analysis of functions/methods that return a `ModuleWithProviders` object did not take the methods of such classes into account. Another edge-case with such intermediate variable was that static properties would not be considered as class members. A testcase was added to prevent regressions. Fixes angular#29078 PR Close angular#29119
|
@JoostK Hi, I'm still having this issue with a lib build with latest next versions:
Is that normal? |
|
@cyrilletuzi you need to try the |
|
@petebacondarwin Thanks for your quick answer. I'm not sure to understand: does it mean a library build with v8.0 won't be able to be compatible with Ivy? |
|
Can you confirm what you are trying to do and what errors you are getting? |
|
Steps to reproduce:
import { StorageModule } from '@ngx-pwa/local-storage';
@NgModule({
imports: [
BrowserModule,
StorageModule.forRoot({
IDBNoWrap: true,
})
]
})
export class AppModule { }
Same error as in #29078: Works if I remove |
|
@cyrilletuzi I am confused. I can't find |
|
@JoostK beta.12 didn't contain the last code, the local I've just published beta.13 if you need it. |
|
It looks like you are trying to build an example app using ivy inside your library project? Is that right? |
|
@petebacondarwin |
|
It appears that the CLI's integration of ngcc is unable to resolve Here's how the @alan-agius4 do you see possibilities to alleviate this problem? |
|
@cyrilletuzi - sorry I didn't spot that the @alan-agius4 could jump in regarding the CLI integration. We do support, I believe |
|
@cyrilletuzi Running ngcc manually on |
|
@JoostK I confirm your debug: it works well in an external app, it's just a problem inside a local app. When doing But when doing |
|
@JoostK With your workaround, tests are now passing, thanks. So it's OK on my side. 👍 |
|
Hi all, the |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #29078
What is the new behavior?
Proper handling of class expressions within ngcc.
Does this PR introduce a breaking change?
Other information
WIP!
Esm2015ReflectionHost#isClass()is aligned withEsm2015ReflectionHost#getClassDeclaration()(as defined in refactor(ivy): correctly type class declarations #29209): refactor(ivy): correctly type class declarations #29209 (comment)