Re:The Cost of JavaScript
by hobofan on Wednesday November 15, 2017 @04:40PM
(#15708095)
Not a hardcore JS-dev, but two things I noticed as someone who has optimized their JS output before:
- I am surprised that this blog post advertises webpack tree-shaking, as it is completely broken right now, and has been for a year[0]
- More and more people are switching to date-fns[1] from moment.js, since it is much smaller and composable by default, and works better with tree-shaking in rollup (or webpack once it's fixed). Yes, their recommendation of ContextReplacementPlugin is valid, but in the case of moment.js, its probably better to just use a replacement.
Re:The Cost of JavaScript
by jeeberz on Wednesday November 15, 2017 @07:57PM
(#15709452)
Angular 5 has been using the webpack ModuleConcatenationPlugin to reduce bundle sizes by half. It does Rollup-like scope hoisting. Google for "angular build optimizer".
- I am surprised that this blog post advertises webpack tree-shaking, as it is completely broken right now, and has been for a year[0]
- More and more people are switching to date-fns[1] from moment.js, since it is much smaller and composable by default, and works better with tree-shaking in rollup (or webpack once it's fixed). Yes, their recommendation of ContextReplacementPlugin is valid, but in the case of moment.js, its probably better to just use a replacement.
[0] https://github.com/webpack/webpack/issues/2867
[1] https://github.com/date-fns/date-fns