Open
Description
Description
Consider this component:
class Component extends LightningElement {}
export { Component as default }
Per ES module syntax, it is equivalent to this component:
export default class Component extends LightningElement {}
However, the second one correctly renders, whereas the first does not. (Repro: 08c93cd .) The component appears to not be treated as a LightningElement
per the @lwc/compiler
– it is simply treated as a plain JavaScript (non-LWC) module.
Steps to Reproduce
Expected Results
export default class Component extends LightningElement {}
is equivalent to
class Component extends LightningElement {}
export { Component as default }
Actual Results
Nothing is rendered, and the component is not registered at runtime as a proper LightningElement.
Version
This issue exists in master
today, as well as LWC v5.0.9 (Spring '24) and v3.0.4 (Winter '24). It even repros in LWC v2.11.8 (Summer '22). So this is a longstanding issue.
Possible Solution
Use the export default class ...
syntax instead.
Activity