-
Notifications
You must be signed in to change notification settings - Fork 392
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
[JS compiler] remove registerDecorators for non-LightningElement classes #2701
Comments
This issue has been linked to a new work item: W-10736098 |
While we're at it, |
This is by design. There is currently no strong signal in the JavaScript code indicating whether a given default export is an LWC component or not. This is the reason why the LWC compiler uses a conservative approach by wrapping all the Here are a couple of examples we currently support: class Foo extends LightningElement {}
export Foo; import BaseComponent from 'x/baseComponent`; // Note: BaseComponent is effectively a class extending from `LightningElement`.
export default class Foo extends BaseComponent {} |
I was thinking we could at least skip export default null But agreed that we can't know at compile time whether a given export is a LightningElement or not. Your first example should be |
No, the first example should also be wrapped with |
For a convoluted set of reasons, this bug is blocking downstream Basically any JS file with a
|
Description
The
@lwc/babel-plugin-component
generatesregisterDecorators
even for non-LightningElement classes.Steps to Reproduce
https://webcomponents.dev/edit/MYuFA04EubKHITYFNgQm
Input:
Output:
Possible Solution
Potentially we can detect a
class
without anextends
(superclass) and avoid doingregisterDecorators
on that class.The text was updated successfully, but these errors were encountered: