3 ms·
Does the full adoption of ES6 modules result in trivial tree shaking? I’ve found that’s one of my favourite effects of libraries adopting the newer module style
by Waterluvian 6y ago
Does the full adoption of ES6 modules result in trivial tree shaking? I’ve found that’s one of my favourite effects of libraries adopting the newer module styles
Edit: it’s modular but the modules I peeked at have sideEffects set and look pretty clean. I’m excited to see what I can do and keep tiny bundles! (I’m obsessed lately with making neat gadgets that load instantly)
- mbostock 6y agoD3 has been written in ES modules since the beginning of 2016 when we adopted Rollup for bundling. The difference now is that we’re adopting ES2015 language features that can’t be transpiled (namely for-of). We didn’t get around to it for 6.0 (mostly for fear of breaking backwards-compatibility in Node), but we plan on adopting type: "module" for Node in the nearish future. In the meantime you can consume D3 as an ES module using Skypack if desired. https://cdn.skypack.dev/d3 https://cdn.skypack.dev/d3