Image viewer cannot be loaded correctly via Vite

Describe Your Question

  • A clear and concise description of what problem you are having.
  • Which OHIF version you are using?
  • 3.11

What steps can we follow to reproduce the bug?

  1. I am using vite for the React App, and try to use iframe to load image viewer
  2. I build the viewer by using PUBLIC_URL=/ohif-viewer/ APP_CONFIG=config/myConfig.js yarn build and changed routerBasename: '/ohif-viewer
  3. I copied files in dist folder to my vite app’s under public/ohif-viewer
  4. I try to load viewer by <iframe src="/ohif-viewer" /> but the issue is vite cannot serve index.html like webpack so I have to change it as <iframe src="/ohif-viewer/index.html" />

The issue is after I added index/html at the end, seems like the viewer cannot find route /index.html, it shows a warning No routes matched location "/index.html" and my iframe is just black

is there a way to solve it? and allow me to use viewer with vite