Skip to content

build: explicitly mark fns to improve tree-shaking#130

Closed
pi0 wants to merge 3 commits intomainfrom
refactor/pure-fns
Closed

build: explicitly mark fns to improve tree-shaking#130
pi0 wants to merge 3 commits intomainfrom
refactor/pure-fns

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented Apr 8, 2024

Related to #129

(This PR is mainly for experimenting)

Add explicit /* @__PURE__ */ marks to improve tree-shaking with a roll-up. (it does not fully trust sideEffects: false in package.json only)

This only works if the rollup treeshake option is set to smallest and by default does not change any behavior still!

Due to ESBuild limitations for minify options, we have to disable whitespace modification which means the default size of dist/index.mjs goes from 3.96 kB to 4.86 kB.

rollup repl

@pi0 pi0 mentioned this pull request Mar 3, 2025
@pi0 pi0 closed this Feb 13, 2026
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