ampproject / ampproject/amphtml
Lint enum usage so that they are fully DCE-able
Open
Stale
Type: Feature Request
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Context: https://github.com/ampproject/amphtml/issues/36453
Currently, enum objects are left in the output binaries because we're using them as dynamic object values (eg, loop keys or performing dynamic `Enum[key]` lookups). In an ideal codebase, enums would be used via `Enum.keyName` lookups only, which means that the value associated with that key can be inlined directly in to output code.
We suspect this is one of the last issue with that causes Terser's outputs to be larger than Closure compiler.
Contributor guide
Assessment
This issue has not been assessed yet.