Open timelyportfolio opened 7 years ago
Can you explain how to implement your current work around please? Where would I change "d3" to "d3v4"? Inside the d3.min of the particular package using v4? Or on the html page itself? Or somewhere else altogether?
very painful and ugly example of a standalone build to prevent conflicts with window.d3 using different versions posted in https://github.com/timelyportfolio/sankeyD3/tree/standalone
To complete the build, I
run npm install
in javascript/lib/d3-sankey using the modified package.json
to get all necessary d3
dependencies. I modified the d3-sankey
package.json out of laziness. For correctness, we should create a package.json
in javascript
directory to install the d3
modules for the htmlwidget.
Copy node_modules directory from javascript/lib/d3-sankey
to javascript/
. See above for the correct way to do to avoid this.
cd javascript
rollup -g d3-selection:d3,d3-array:d3,d3-zoom:d3,d3-scale:d3,d3-color:d3,d3-drag:d3,d3-collection:d3,d3-axis:d3,d3-interpolate:d3 -f umd -n sankeyNetwork -o sankeyNetwork-rollup.js -- index.js
browserify sankeyNetwork-rollup.js > sankeyNetwork.js
cp sankeyNetwork.js ../inst/htmlwidgets/sankeyNetwork.js
Then for now when calling sankeyNetwork
use colourScale = "d3Scale.scaleOrdinal().range(d3Scale.schemeCategory20)
.
conflict v3 to v4
Until other
htmlwidgets
have converted tod3v4
, the dependency management mechanism will choose the greatest version ford3
, which will bed3v4
. Then thewindow.d3
will be version 4 which will cause all other htmlwidgets on the page to fail. This will become more and more problematic, since the conversion by other widgets to d3 seems like it will be very slow.solutions?
I am not sure how best to handle, so I thought I would start the discussion. Currently I have only one solution and it is unfortunately not ideal.
d3v4
to bewindow.d3v4
or something other thanwindow.d3
. This is an easy change but would require all references tod3
to be changed tod3v4
. Also, it would mean we would have two sets ofd3
. Fortunately,d3
is not massive, but total would be about 500kb.