Skip to content

Make lz-string tree-shakable for bundlers #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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