Skip to content

Conversation

@Khyati-Kapil
Copy link

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