PDF Viewer not working in production build of buildScripts

Hello there,

I noticed you are using React 18 in your project. Could you try using React 16 instead and see if that resolves the issue?

Hello Chen

Considering other dependency we need to use React V18 only. Looking forward for your update of PDFViewer for this production build issue with latest React version

But still it didn’t work for React 16 as show below

Thanks
NIrmal KUmar.R

Hi there,

Please remove the repo as there is a license key in your application.

We think this could be an issue with the routing (react-router) in the application. It looks like you will need to do further configuration. In the network tab of your production build, you can see the ui get requested but the response is incorrect.

ui in network
image

The response is not returning the right file, instead it is returning your application’s entry point (index.html).
image

It looks like you route invalid wildcard routes to the dashboard. This could explain why the dashboard appears instead of the viewer.

<Route path="*" element={<Navigate to="/dashboard" />} />

Another thing to note is that this path appears incorrect when viewing the WebViewer div. It is likely from the start_url prop in the manifest. The issue seems to get resolved for dev but not production.
image

You will need to configure the WebViewer lib to be served along the other static assets.

Hello everyone,
I think i am having the same issue, i am using react 18.2 , i copy the assets to public folder and try to launch the app in production mode and i get this:

Can you please help me with this ? the effect on the ui is that it loads my index page in the current page.

Thank you.

Chen

Still not able to load pdfviewer in production build of react.
What i have basic admin dashboard template of Material Dashboard 2 React: Free MUI & React Admin Template @ Creative Tim.
Router issue you pointed out is it because it is redirected to index page in case of production build

FYI ,Removed repo

Thanks
NIrmal Kumar.R

Hello,

You may need to eject the app and look more into the React Router documentation.

Were you able to configure the router settings?

Could you try using HashRouter instead of BrowserRouter and see if that resolves issue?