Skip to content

Conversation

@FezVrasta
Copy link
Contributor

@FezVrasta FezVrasta commented Aug 4, 2021

Having vtk.js as a dependency makes it extremely difficult to avoid double versions of the same library if vtk.js is also listed as dependency of the project itself.

Just like it happens with React, I think vtk.js should be a peerDependency so that the consumers can better control it.

Keep it mind 99% of the users using this library are likely going to also import from vtk.js directly to access utility modules and such, so they will need to add a vtk.js version to their package.json too.

@jourdain
Copy link
Collaborator

jourdain commented Aug 4, 2021

@floryst what do you think?

@floryst
Copy link
Contributor

floryst commented Aug 4, 2021

I think this makes sense. Chances are, if you are using react-vtk-js you will also have vtk.js as well.

@jourdain
Copy link
Collaborator

jourdain commented Aug 4, 2021

For me when I use react-vtk-js, I don't use or have vtk.js as a dependency. But 2 vs 1, I'm merging... ;-)

@jourdain jourdain merged commit 0143b2c into Kitware:master Aug 4, 2021
@jourdain
Copy link
Collaborator

jourdain commented Aug 4, 2021

🎉 This PR is included in version 1.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@FezVrasta
Copy link
Contributor Author

For me when I use react-vtk-js, I don't use or have vtk.js as a dependency. But 2 vs 1, I'm merging... ;-)

It's not recommended to import from libraries that are not directly listed in your package.json, you lose the ability to lock its version and if for whatever reason the library that makes the transitive dependency available switches to a different one your app breaks.

@tamaynard tamaynard mentioned this pull request Aug 9, 2021
floryst added a commit to floryst/react-vtk-js that referenced this pull request Aug 12, 2021
In reference to Kitware#28, we should not bundle `@kitware/vtk.js`. Additionally, this directly impacts `vtkMapper`, as setting global/static coincident topology parameters is done at a module level, and bundling vtk.js with react-vtk-js means it's impossible to set global parameters for react-vtk-js.

This will mean all consumers must install `@kitware/vtk.js` alongside react-vtk-js. Should this be a breaking change, or are we okay having people realize this once npm/yarn complains about missing peer deps?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants