I recommend pinning this to @d3/nested-treemap@149 since I will soon be rewriting this example as a reusable chart component (i.e., a Treemap function).
I recommend using a CSV here instead of require; a CSV is more self explanatory. (It avoids the question of “how do I replace the cars dataset with my own dataset”?)
I recommend not requiring D3 here, since it’ll cause multiple copies of D3 to be loaded. If you stick to the built-in copy of D3 across all notebooks you guarantee that you’ll always use the same version. (And also it’ll load faster since it doesn’t need to fetch the package.json.)