Skip to main content
Version: 3.9.0-beta.46 (Latest)

Introduction

Local linking allows you to develop and test a library in the context of an application before it's published or when you encounter a bug that you suspect is related to a library. With Yarn, this can be achieved through the yarn link command.

The general procedure is as follows:

Link the Library:

cd /path/to/library
yarn link

This command will create a symlink in a global directory for the library.

Link to the Application:

cd /path/to/application
yarn link "library-name"

Creates a symlink from the global directory to the application's node_modules.

Tutorial for linking Cornerstone3D to OHIF

Below we demonstrate how to link Cornerstone3D to OHIF Viewer. This is useful for testing and debugging Cornerstone3D in the context of OHIF Viewer.

::tip Since @cornerstonejs/tools depends on @cornerstonejs/core, if you need the changes you made in @cornerstonejs/core to be reflected in @cornerstonejs/tools, you need to also link @cornerstonejs/core to @cornerstonejs/tools.

cd /path/to/cornerstonejs-core
# for the core
yarn link

cd /path/to/cornerstonejs-tools
yarn link "@cornerstonejs/core"

# for the tools
yarn link

# inside OHIF
cd /path/to/OHIFViewer
yarn link "@cornerstonejs/core"
yarn link "@cornerstonejs/tools"