trinary/d3-transform

d3-transform is difficult to use with node tools, resulting in "d3 not defined" errors

Closed this issue · 2 comments

Firstly, thanks for providing d3-transform. I am finding it quite useful and generally pleasure to use.

However, d3-transform is difficult to use with node tools like "browserify".

There are two problems:

  • d3-transform adds itself to d3.svg but, unfortunately, d3 no longer adds itself to the global namespace if d3 has been loaded using node's "require" method.
  • package.json refers to a non-existent index.js

It leads to "d3 not defined".

d3-transform.js should only attempt to assign the "transform" method to d3.svg if d3.svg exists, and should also assign the "transform" method to module.exports if module.exports exists. Perhaps even add it to the global namespace if neither d3 nor module.exports are defined.

Since #8 has been merged, this should be closed.

👍 Thanks.