I’ve created a three.js lib volograms-js - npm but when using it, it in another project, it generates WARNING: Multiple instances of Three.js being imported.
I know that there are differents build/config to distinct, the final build of the demo and the “build”/config used by another project. Currently no already built code to be used by another project is published.
[edit] I’m not even sure, if the example I gave (three-projected-material) is not loading twice Three.js as it uses three 0.124 which doesn’t display that warning.
On vologram-js if I replace "peerDependencies": {"three": "^0.136.0"} with "peerDependencies": {"three": "^0.124.0"} the warning is not displayed
you don’t need to configure anything in webpack. but you should put three into peer not dependencies. externals would be worse. give peer the lowest possible three variant that your library can work with.
"peerDependencies": {
"three": ">=0.137"
},
npm install will now already warn if that range isn’t fulfilled.
if three is still being referenced with varying versions your can try aliasing three to node_modules which would work, but since three has breaking changes every minor version i don’t know if that’s a good idea.
the libraries we push … we are very strict. move up to three latest or we don’t support you. i dislike doing it but three forces us because there’s no sem ver and no guarantee that updates won’t break.
yes you are right, it must be naturally handled. if it’s not some lib i between has a messed up package description. version mismatch is quite common, most people have no idea how many lodashs or babel-runtimes they ship.