Closed khanhphamqn closed 4 years ago
The PWA build includes all extensions in the monorepo by default. You can see them listed in platform/viewer/src/index.js
.
When you use yarn run build:package
, you're creating separate bundles for the "Viewer" platform, and for each extension. Each extension bundle needs to be manually included, and then listed in the application's extensions
configuration. You can see an example of this flow in this code sandbox: https://codesandbox.io/s/viewer-script-tag-microscopy-extension-44unk
<body>
<div id="root"></div>
<script src="https://unpkg.com/@ohif/viewer@1.1.10/dist/index.umd.js"></script>
<script src="https://unpkg.com/@ohif/extension-dicom-microscopy@0.50.0/dist/index.umd.js"></script>
<script>
var containerId = "root";
var componentRenderedOrUpdatedCallback = function() {
console.log("OHIF Viewer rendered/updated");
};
window.OHIFViewer.installViewer(
{
servers: {
dicomWeb: [/* server config */]
},
extensions: [OHIFExtDicomMicroscopy]
},
containerId,
componentRenderedOrUpdatedCallback
);
</script>
</body>
If you're already building the application after making changes, I recommend using yarn run build
and tweaking the entrypoint to meet your needs.
I did create a related issue from your report. The 2D MPR
button should not show unless the VTK Extension is registered. It looks like we currently have it "hard coded" into the Viewer project (part of the core platform)
@dannyrb Thanks for your helpful information. As far as I know the defauft config will be in folder
platform/viewer/public/config/default.js.
Is it possible if I would like to add all extensions in this file such OHIFVTKExtension, OHIFDicomHtmlExtension OHIFDicomMicroscopyExtension OHIFDicomPDFExtension
.
Actually, I followed the code in platform/viewer/src/index.js
and applied it into the file platform/viewer/src/App.js
and it works well when using yarn build:package. But I think it is so risky or something like that. That's why I would like to ask.
I would appreciate if you could help me.
Actually, I followed the code in platform/viewer/src/index.js and applied it into the file platform/viewer/src/App.js and it works well when using yarn build:package. But I think it is so risky or something like that. That's why I would like to ask.
This would do the trick. It would include all of the extensions in the created @ohif/viewer package. I'm still unsure of why you're using this approach instead of the PWA (yarn run build
).
It's not risky, it's just sub-optimal.
@dannyrb . I really appreciate your help. I did use yarn run build
command but this command created a bunch of files. it looks like below image
That's why I used above approach instead of yarn run build
How are you trying to deploy/host the application? The fact that there are more files provides an advantage. The application is able to load/render much faster, and as other portions of the application are required, their (much smaller) files are requested. There are other advantages, but that's at least a little insight into why there are more files.
I would normally recommend using the packaged version for simple demonstrations, or if you only need basic 2D viewing.
At the end of the day, both can work. Choose whatever works best for you ^_^ Both setups can work if configured correctly.
@dannyrb Thank you so much for your help. I think I should close this issue
Bug Report
Command "mpr2d" not found in current context
Describe the Bug
This issue works well on develop but when using yarn build:package to build production it will appear
What steps can we follow to reproduce the bug?