Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

[Bug] window.browserImportFunction is not a function (3.10.1 and master)

Open chbcplatforms opened this issue 6 months ago • 1 comments

Describe the Bug

Hello,

I know the subject has already be treated but I have still this error message when using microscopy:

Uncaught (in promise) TypeError: window.browserImportFunction is not a function oe pluginImports.js:104 importDicomMicroscopyViewer MicroscopyService.ts:74 N DicomMicroscopyViewport.tsx:40 N DicomMicroscopyViewport.tsx:181 w DicomMicroscopyViewport.tsx:192 React 7 C scheduler.production.min.js:13 P scheduler.production.min.js:14 50041 scheduler.production.min.js:14 Webpack 13

Steps to Reproduce

  1. Using a dockerfile to create a npm plugin including into my own app (run under django 4.2)

here an extract from my dockerfile: `RUN git clone https://github.com/OHIF/Viewers.git --branch ${RELEASE_TAG} --single-branch

RUN ls -la /ohif/Viewers

WORKDIR /ohif/Viewers

copy our html template so we generate the index.html that will

function well with our applications

COPY ["index.html", "/ohif/Viewers/platform/app/public/html-templates"] COPY ["rollbar.html", "/ohif/Viewers/platform/app/public/html-templates"] COPY ["app-config.js", "/ohif/Viewers/platform/app/public/config"] RUN yarn config set workspaces-experimental true RUN yarn install --verbose

There are two important ENV VARs to pass into the yarn build

Set the HTML_TEMPLATE to the file we copied just above

Set the PUBLIC_URL to the value expected within the Application

RUN HTML_TEMPLATE=index.html PUBLIC_URL=/viewer-ohif/ yarn run build \ && PUBLIC_URL=/viewer-ohif/ yarn run cli list #check that ohif mode and extension are already imported ` NOTE: documentation is not very clear about this point: both extension and mode for microscopy are already present in the current releases by default ? Of something must be set with yarn run cli ?

On my file app-config.js (the config file) I have:

extensions:["@ohif/extension-dicom-microscopy"], modes:["@ohif/mode-microscopy"],

and on the index.html:

`

`

NOTE: /dicom-microscopy-viewer/dicomMicroscopyViewer.min.js is correctly called and returned by django. def dicom_microscopy_viewer(request): dcm_micro_path = f"{settings.BASE_DIR}/dicomviewer/static/dicomviewer/lib/ohif/dicom-microscopy-viewer/dicomMicroscopyViewer.min.js" response = HttpResponse(open(dcm_micro_path).read(), content_type='application/javascript') return response # send back 200
I try first with the 3.10.1 ohif release and later today with the master branch and I had the same behavior.

PS: I think a little more details about default available extension and mode in documentation would be appreciated.

Thank you very much for your work.

The current behavior

ohifviewer is infinitely loading and SM dicom are never displayed. (occure with microscopy mode and basic viewer)

The expected behavior

SM microscopy image

OS

ubuntu LTS 24.04

Node version

node:23.11.0

Browser

firefox

chbcplatforms avatar May 20 '25 14:05 chbcplatforms

Can you check out these docs https://docs.ohif.org/deployment/custom-url-access also look into our dockerfile that handles microscopy differently

sedghi avatar Jun 04 '25 00:06 sedghi