consento-org / consento-org/longfn
Improve tree shaking?
- Dominant language
- JavaScript
- Stars
- 8
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I was interested in using longfn to reduce bundle size a little bit compared with long.. I thought the 'pure function' way that longfn works might lend itself to tree shaking but the bundle was maybe not 'tree shaken'.
I probably obsess over bundle size too much but it is including the entirety of longfn (6kb minified) instead of just the functions imported. (for comparison long.js ~10kb minified)
A production build using vite with just longfn imported can show this

Screenshot above made using "yarn build" in the repro, then running server in dist, and running "npx bundle-wizard http://localhost:3000"...of course react the major culprit in bundle there
Repo here, very minimal https://github.com/cmdcolin/longfn-tree-shake-repro/blob/master/src/App.tsx
Contributor guide
Assessment
This issue has not been assessed yet.