deck.gl dependency strategy
Some users suggest that we establish a better strategy on deck.gl's dependency requirement and communicate it. Right now, luma.gl is a peer dependency of deck.gl that require user to install it themselves.
Completely agree that it would be great to simplify the peer dependency situation. Just not sure how, Suggestions are most welcome.
The root cause is that npm is designed to install different versions of the same module, if two modules depend on it with incompatible semver versions.
For many utility type modules, simply installing two copies is a clever solution to mismatched dependencies. But in a library like luma.gl, luma objects are being created by the app and used as arguments to functions from luma.gl. Those objects must be created by the same version of the library or bad things can and will happen.
So, the reason that luma.gl is a peer dependency of deck.gl is that an application can only have one copy of luma.gl. For many apps this is not an issue, since they only install it through deck.gl, but some apps either use luma directly, or together with another module that uses luma or deck, and the app needs to ultimately decide which version everyone uses.
By the way, React has the same problem - All react components must install react as a peer dependency. Which seems to indicate that it is not a trivial problem to solve.
All our major modules: luma.gl, deck.gl and react-map-gl are undergoing major reduction of npm dependencies for v3.0.0. Unfortunately it doesn't address the peer dependency problem, but it is still a major reduction to the cost of including these libraries into an app - installs will be faster, compiles and loads will be faster, and apps will be smaller.
Since I don't see a way of improving the peer dependencies themselves, I will close this for now. Will track it on the workboard.
- Related discussion: https://github.com/visgl/deck.gl/issues/8802