block by robinhouston 0d2f455b1ddad476e20a495a220f7a19

D3 Custom Bundle

Full Screen

This is a demonstration of building a custom D3 4.0 bundle using ES2015 modules and Rollup. Custom bundles can be optimized to contain only the code you need. This example exposes just three fields on the d3 object: d3.event, d3.select and d3.selectAll. The minified and gzipped bundle is only 3,691 bytes, a savings of 93% over the default build!

To build:

npm install
npm run prepublish

You may also run Rollup and UglifyJS directly:

rollup -c && uglifyjs d3.js -c -m -o d3.min.js

index.js

index.html

d3.min.js

package.json

rollup.config.js