christophergandrud / networkD3

D3 JavaScript Network Graphs from R
http://christophergandrud.github.io/networkD3
650 stars 269 forks source link

avoid dependency version conflicts with other htmlwidgets #162

Open cjyetman opened 7 years ago

cjyetman commented 7 years ago

There has been some discussion about this here #143

In short, if two htmlwidgets are being displayed on the same page and they use the same Javascript dependency but different versions, those dependencies can overwrite each other when they are loaded/added to window. Additionally, if they have the same name in their YAML file, htmlwidgets will only load the one with the highest version number. I point this out separately because even if htmlwidgets did load both versions, there could still be a collision when they were loaded onto window. This is most notably an issue with incompatibilities between D3v3 and D3v4.

It would be great to collect all discussion, ideas, links, hints, etc. about this problem in one issue here. @timelyportfolio, you seem to have been following this problem for a while, so it would be nice if you could copy in here those ideas and links to similar solutions or discussions in other packages.

cjyetman commented 7 years ago

a few links to discussions elsewhere about this problem... htmlwidgets: d3 v4 htmlwidgets: Robust javascript dependency handling in the browser htmlwidgets: iframe support sankyD3: handle d3v3, d3v4 conflicts with other htmlwidgets

IsabelFE commented 2 years ago

Hi, I see comments about this issue from 5 years ago. I am having the same problem still in 2022. Has this being fixed?

cjyetman commented 2 years ago

I don't think a solution was ever found, it's just a known problem.

I started building a new package with similar functionality but based on {r2d3} which circumvents this problem, but it is not complete. https://cjyetman.com/network.r2d3/