4 ms·
Why not just strip out unused code? This has existed in other toolchains for years.
by bathtub365 3y ago
Why not just strip out unused code? This has existed in other toolchains for years.
- thephyber 3y agoTree shaking exists in build tools, but (1) libraries like Lodash have functions that use many other functions in the same library (for DRY reasons) and (2) the issue with NPM libraries is that they generally pull in all dependencies and Dev dependencies, not just an efficient dist / build minimal code set.
- 8n4vidtmkvmk 3y agoFwiw I strip out my dev deps before publishing. I've started bundling in the prod deps and stripping them too. That way if I need like 5 random functions from 5 random packages the end result just includes the 5 funcs and has 0 deps. It avoids version issues too. And I don't minify anymore so it's very readable.