I’ve just had a similar issue. d3-scale-chromatic is no longer part of d3 and I had to copy and paste its source in order to make it work in my plugin. I don’t think this is a very good solution.
You mention that “npm installs d3 code into the node_modules directory”. Do you mean core grafana node_modules directory or the plugins directory?
I’ve installed the d3-scale-chromatic into plugin’s node_modules but wasn’t able to import it - grafana tries to load it from public directory (http://localhost:3000/public/d3-scale-chromatic). Is there some way to make it load from the plugin’s node_modules directory? And if not, have you thought about implementing it? I think it would help to achieve much cleaner solution in case when plugin needs to use an external library.
Thanks for reply.