Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: enforce ascii_only in terser to ensure ASCII-only minified bundle fixes(#4043)#4088

Open
Khyati-Kapil wants to merge 1 commit intod3:maind3/d3:mainfrom
Khyati-Kapil:khyatiKhyati-Kapil/d3:khyatiCopy head branch name to clipboard
Open

fix: enforce ascii_only in terser to ensure ASCII-only minified bundle fixes(#4043)#4088
Khyati-Kapil wants to merge 1 commit intod3:maind3/d3:mainfrom
Khyati-Kapil:khyatiKhyati-Kapil/d3:khyatiCopy head branch name to clipboard

Conversation

@Khyati-Kapil
Copy link
Copy Markdown

This PR fixes #4043.

The minified D3 bundle (d3.min.js) previously included non-ASCII characters
such as µ and . When these characters appear in a minified JavaScript
bundle, browser engines must represent the entire file as a 2-byte UTF-16
string rather than a 1-byte Latin-1 string, which increases memory usage and
slows down parsing.

This PR updates the Rollup Terser configuration so that the minified output is
ASCII-only.

What was changed
Terser defaults to ascii_only: false. This allows Unicode characters to pass
through during minification. To enforce ASCII-only output:

  • format.ascii_only: true has been added to the Terser configuration.
  • The previous use of the output key has been merged into the format block,
    because Terser requires either format or output (not both).
  • The preamble banner is now emitted via format.preamble.

Updated terser() configuration:

terser({
  format: {
    preamble: config.output.banner,
    ascii_only: true
  },
  mangle: {
    reserved: ["InternMap", "InternSet"]
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

non-ascii chars in minified bundle

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.