Skip to content

fix(ssr): handle export { Cmp as default } @W-17655297#5176

Merged
wjhsf merged 10 commits intomasterfrom
wjh/export-cmp-as-default
Jan 31, 2025
Merged

fix(ssr): handle export { Cmp as default } @W-17655297#5176
wjhsf merged 10 commits intomasterfrom
wjh/export-cmp-as-default

Conversation

@wjhsf
Copy link
Contributor

@wjhsf wjhsf commented Jan 29, 2025

Details

The most correct thing to do would be to treat export { Cmp as default } identically to export default Cmp. But engine-server's "what is an LWC component" logic is faulty, so export { Cmp as default } is kinda a component, but also kinda not. It's weird.

Partially addresses #4020 for ssr-compiler.

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.
  • 💔 Yes, it does introduce a breaking change.

Does this pull request introduce an observable change?

  • 🤞 No, it does not introduce an observable change.
  • 🔬 Yes, it does include an observable change.

GUS work item

@wjhsf wjhsf requested a review from a team as a code owner January 29, 2025 21:48
export function unimplementedTmpl(tagName: string, Cmp?: LightningElementConstructor): string {
let html = `<${tagName}>`;
if (Cmp?.renderMode !== 'light') {
html += '<template shadowrootmode="open"></template>';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be rendering the slotted content here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realized the component could just use fallbackTmpl so removed unimplementedTmpl

@wjhsf wjhsf enabled auto-merge (squash) January 31, 2025 16:40
@wjhsf wjhsf merged commit 8eec50f into master Jan 31, 2025
11 checks passed
@wjhsf wjhsf deleted the wjh/export-cmp-as-default branch January 31, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants