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

[all] Size regression when emitting ES2021 #3777

Closed
rictic opened this issue Mar 31, 2023 · 5 comments
Closed

[all] Size regression when emitting ES2021 #3777

rictic opened this issue Mar 31, 2023 · 5 comments
Assignees
Labels

Comments

@rictic
Copy link
Collaborator

rictic commented Mar 31, 2023

In #3775 we're advancing our output to ES2021, but we're seeing a size regression in our built output.

We're probably going to move forward for now with ES2021 in the pre-releases, just to get early signal about whether that breaks anything, but before we launch we need to reevaluate this because it's probably not worth it to advance the language version at the cost of size.

@rictic rictic added the 3.0 label Mar 31, 2023
@MrHBS
Copy link

MrHBS commented Apr 2, 2023

Isn’t it a bit early to switch to ES2021?

@justinfagnani
Copy link
Collaborator

We published ES2019 in 2021. Publishing ES2021 in 2023 is pretty in line with that.

We're somewhat more aggressive here than other libraries, but this matches our past language support going back to lit-html 1.0 and Polymer 3.0. ES2021 has excellent support across browsers. Logical assignment support goes back to Chrome 85 / Firefox 79 / Safari 14. Nullish coalescing (ES2020) goes to 80 / 71 / 13.1. And all syntax is compilable to older language levels without polyfills for applications that need to do that.

@justinfagnani justinfagnani changed the title [Lit 3] Size regression when emitting ES2021 [all] Size regression when emitting ES2021 May 10, 2023
@rictic
Copy link
Collaborator Author

rictic commented Jun 10, 2023

Steve tracked this down, dead code elimination of the debugEventLog statements wasn't triggering, I guess the version of terser we're using can't dead code eliminate code like:

const foo = undefined;
foo?.();

@rictic
Copy link
Collaborator Author

rictic commented Jun 10, 2023

With that fixed, lit-html.js minifies down to 7,220B, down from a bit over eight thousand

@rictic
Copy link
Collaborator Author

rictic commented Sep 20, 2023

This is fixed

@rictic rictic closed this as completed Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants