Npm Link for vtk.js

I’d like to contribute a PR that addresses this issue:

Draft PR here:

Before submitting my PR, I’d like to try out the code I’ve written locally in my project to make sure it works. I’m running into a problem where I can’t figure out how to link to my local, edited version of vtk.js.

I’ve tried following the instructions here:

And here:

This hasn’t been working for me :confused:

I’m also a little confused about the different build scripts in the package.json file.

npm build

Which is suggested for the development build serves a webpack-dev-server (at localhost:8080 for me) but I’m not able to connect to the server? Also not sure how I would link to the module that way.

It seems like others have had this problem before?

Any guidance on how to link to my edited module locally so I can test contributions before submitting would be greatly appreciated.

Ok so I worked around this issue by running

npm run build:release
npm run release:create-packages

Then copying the contents of pkg/esm to my @kitware/vtk.js folder in my project’s node_modules folder. Seems like a good enough solution for now. :sweat_smile:

2 Likes

npm link unfortunately doesn’t quite work with vtk.js packages, since we publish @kitware/vtk.js and vtk.js which are two different builds of the same release. Thus, we output our distribution files to the pkg/ folder. Your approach is the most straightforward at the moment. :slight_smile:

1 Like