-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve tree shaking? #4
Comments
Hello @cmdcolin - I am happy to accept PR that block any tree shaking from happening. It would be great if you could look into the vite tree-shaking settings and see if that could work for you first though: https://dev.to/rafaelogic/optimizing-vuejs-performance-a-guide-to-tree-shaking-with-webpack-and-vite-3if7 |
I actually make a library that other people use so i would like to avoid too much that involves end users having to customize bundler settings. I observed the same thing in both webpack and vite so far. my hypothesis is the manipulation of the globals could contribute to it, but i will have to check... potentially those globals are pretty core to the library, so if it's out of scope, can close this too... |
The end-users might use your library in combination with |
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
The text was updated successfully, but these errors were encountered: