Skip to content

Conversation

y-hiraoka
Copy link

Description:

This pull request introduces a small but impactful change to the lz-string library to make it tree-shakable by modern bundlers. By modifying the entry point structure, this change enables a significant reduction in bundle size—over 30% when using esbuild without minification.

Details:

  • Before: import defaultExport from "lz-string"
  • After: import * as defaultExport from "lz-string"

This adjustment allows bundlers to effectively eliminate unused code, leading to leaner bundles. When using a single compress/decompress pair, this resulted in a 30% reduction in size. Although this change slightly alters how the library is imported, it offers considerable benefits in terms of performance and efficiency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant