Skip to content
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

fix(ssr): remove unused imports #4873

Merged
merged 6 commits into from
Nov 15, 2024
Merged

fix(ssr): remove unused imports #4873

merged 6 commits into from
Nov 15, 2024

Conversation

nolanlawson
Copy link
Collaborator

Details

Fixes #4793.

This solves the Gordion knot by cutting it. I added an extra AST transform to remove unused imports from @lwc/ssr-runtime. This means we don't need to manually track any imports during AST generation.

Does this pull request introduce a breaking change?

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

Does this pull request introduce an observable change?

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

@nolanlawson nolanlawson requested a review from a team as a code owner November 15, 2024 18:19
@@ -235,6 +231,8 @@ export const Element: Transformer<IrElement | IrExternalComponent | IrSlot> = fu
childContent = [];
}

cxt.hoist(bImportHtmlEscape(), importHtmlEscapeKey);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can probably simplify our ctx.hoist() logic elsewhere as well (since we can basically just import everything from @lwc/ssr-runtime once and let the optimizer do its magic) but I've punted on that for now.

@nolanlawson nolanlawson merged commit b47e18c into master Nov 15, 2024
11 checks passed
@nolanlawson nolanlawson deleted the nolan/unused-imports branch November 15, 2024 20:40
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.

[SSR v2] Fix unused imports from '@lwc/ssr-runtime'
2 participants