Closed Sacharified closed 4 years ago
Wouldn't the node.js peer dependency solve that specific issue? https://nodejs.org/en/blog/npm/peer-dependencies/
You would be able to define a new section in your package.json
and your plugin will use the video context's version in the host package.
Is there a case that I am not considering here?
@gsouquet You're probably right, I didn't consider that! Thanks.
Problem
I have a custom source node (https://github.com/Sacharified/videocontext-gif-source) which extends the canvas node, published as an NPM package. To extend the canvas node, I have to import the whole of VideoContext in my package. An application which consumes this package will also likely include VideoContext. If the version of VideoContext in the consumer application does not match the version in the package, the consumer's bundle will include two different versions of VideoContext, bloating its size unnecessarily.
Solutions
There are several ways this can be addressed:
Example
Package:
Consumer: