Skip to content

Comments

Make lz-string tree-shakable for bundlers#269

Open
y-hiraoka wants to merge 1 commit intopieroxy:masterfrom
y-hiraoka:tree-shakeable
Open

Make lz-string tree-shakable for bundlers#269
y-hiraoka wants to merge 1 commit intopieroxy:masterfrom
y-hiraoka:tree-shakeable

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