-
Notifications
You must be signed in to change notification settings - Fork 12k
fix(@ngtools/webpack): replace resources should effect only class dec… #12503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm this is a tricky one. Pretty sure some usecases are going to be broken by this. Like consts outside of the decorator that compose properties.
But I kinda think we should reduce the magic we do, and be more clear about it. It's not intuitive at all that that things can break by having a templateUrl
property anywhere. I'm pretty sure this ended up causing some AngularJS templates to also be processed, for instance.
Adding the discussion label to make sure everyone is onboard with the direction.
Personally I think this PR should go in, and enhanced with some information about the magic we do in a readme, either CLI or ngtools/webpack (or both). Stuff like "templateUrl and stylesUrl will be processed if found within decorators, loadChildren will also be processed and should have a relative path or from the tsconfig baseUrl".
We can also do an addition checks that we only process Ex import { Component as NgComponent} from '@angular/core'
import { Component } from '@angular/core'
import * as ng from '@angular/core' |
Feel free to resurrect all or part of this old PR: #8401 |
@clydin thanks, ill continue this tomorrow. that |
/cc @alxhub - this seems related to how the AOT compiler works - but in this case we need to do some transform for JIT Also related to how we'd like to get away from JIT mode altogether when Ivy is just a tsc plugin |
FWIW, Ivy requires that component metadata be inlined into the decorator. Personally, I think this PR should land. You already don't support the full capabilities of
Trying to support all of this and resolve metadata in the same ways that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especially like all the new tests 👍
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. |
Replace resources should effect only class decorators
At the moment we are processing all property assignments in object literals irrespective if they are in a decorator or not. With this change we will process only property assignments found under a class decorator.
Fixes #12488, Fixes #6007, Fixes: #6498 and Fixes: #8295