-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: Improper encoding of prod files #8238
Description
Lexical version:
latest
Steps To Reproduce
- Open ./Lexical.prod.js
- Find matches against this regex:
/[^\x00-\xFF]/
The current behavior
Notice how we find more than 0 matches.
The expected behavior
We should be finding exactly 0 matches.
Impact of fix
Basically in some setups (like Meta's) this causes the file Lexical gets bundled in to require double the amount of memory unnecessarily, because it contains characters that don't fit in 1 byte (see the regex above), which causes every modern engine to encode the string using 2 bytes per character rather than 1 byte per character.
For example this exact issue coming from Lexical.prod.js is causing roughly between 3 and 5 MB of memory usage to be wasted for each WhatsApp Web user.
Users could re-minify the file to make sure this issue doesn't happen, but since this is distributed as a prod build that is already minified I think the issue shouldn't be presented there to begin with.