Dependencies of linked extensions not found

Hello everyone!

Describe Your Question

I am trying to get started building a new extension+mode in OHIF v3 and I’m facing a dependency issue when using the provided CLI.

It seems that when building the application (Viewers) after linking my extension, its dependencies are not found.

What steps can we follow to reproduce the bug?

Here what I’m attempting:

git clone viewers
cd viewer
git checkout v3-stable

# Create an extension at ../my-extensions
yarn cli create-extension
cd ../my-extension
yarn add @cornerstonejs/nifti-image-loader

# Insert import line in index file of my extension
sed -i '2 i import * as cornerstoneNIFTIImageLoader from "@cornerstonejs/nifti-image-loader";' src/index.js

cd ../viewers
yarn run cli link-extension ../my-extension
yarn dev:orthanc

I can see my extension and my extension’s dependency being linked,

$ l platform/viewer/node_modules/my-extension 
lrwxrwxrwx 1 gabriel gabriel 48 Jul  8 15:55 platform/viewer/node_modules/my-extension -> ../../../../../../.config/yarn/link/my-extension

however webpack complains that it can’t resolve my dependency.

Module not found: Error: Can't resolve '@cornerstonejs/nifti-image-loader' in '/home/gabriel/Code/ohif_test/my-extension/src'

I was wondering if I’m not using the extension mechanism right ?
Any help appreciated!


1 Like