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

TypeScript enum optimizations #5271

Merged
merged 2 commits into from Mar 3, 2023
Merged

TypeScript enum optimizations #5271

merged 2 commits into from Mar 3, 2023

Conversation

robwalch
Copy link
Collaborator

@robwalch robwalch commented Mar 3, 2023

This PR will...

Inline existing enums as much as possible by using const enums and limiting export scope.

Why is this Pull Request needed?

Reduces bundle size and module complexity.

See babel's babel-preset-typescript optimizeConstEnums for optimizations. Many of the enums in the library are exported as types and thus are not completely inlined. This change at least replaces IFFE output with object literals and inlines where possible.

@itsjamie
Copy link
Collaborator

itsjamie commented Mar 3, 2023

File File Size - master File Size - branch Savings
hls.js 1173953 1168296 5657
hls.min.js 408286 404912 3374

@robwalch robwalch merged commit b4cb700 into master Mar 3, 2023
@robwalch robwalch deleted the task/optimize-const-enums branch March 3, 2023 19:44
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.

None yet

2 participants