Another demonstration of a custom D3 bundle using Rollup. This demonstrates importing d3-transition, which modifies selection.prototype to define selection.transition:
import "d3-transition";
(There are other features in d3-transition, but they are not imported here because they are not used.) Note that you must also import selection
from d3-selection; otherwise, Rollup doesn’t know that it needs to include the imported code from d3-transition. Rollup isn’t perfect at detecting which code needs to be included (and which code shouldn’t be included), so sometimes you need to give it a hand.
xxxxxxxxxx
<meta charset="utf-8">
<body>
<script src="d3.min.js"></script>
<script>
d3.select("body").append("h1")
.text("Hello, world!")
.style("text-align", "center")
.style("line-height", "320px")
.style("font-size", "100px")
.style("transform", "rotate(-180deg) scale(0.001, 0.001)")
.transition()
.duration(1500)
.style("transform", null);
</script>