Skip to content

Bug: Improper encoding of prod files #8238

@fabiospampinato

Description

@fabiospampinato

Lexical version:

latest

Steps To Reproduce

  1. Open ./Lexical.prod.js
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions