PDF not loaded on build version Nuxt3

Which product are you using?
PDF.js Express

PDF.js Express Version

Detailed description of issue
I am using pdf.js express with my Nuxt3 application. I have installed pdf.js express with npm and copied the static files from node_modules/@pdftron/pdfjs-express/public to my Nuxt application public/lib folder. Everything was working fine when I run in the node server in browser, but when I try to run a build version of my Nuxt application I was not able to open any pdf file, showing net::ERR_ABORTED 404 (Not Found) error

Code snippet


    <div id='webviewer' ref='viewer'></div>

  export default {
    name: 'WebViewer',
    props: {
      path: String,
      url: String
    mounted: function () {
      import('@pdftron/pdfjs-express').then(() => {

              path: '../lib',
              initialDoc: this.url, // replace with your own PDF file
              licenseKey: '',
            }, this.$refs.viewer).then((instance) => {
              // call apis here

  #webviewer {
    height: 100vh;

And the error I get in my console after running the build version:

Hello Yeasir,

Thank you for contacting us.

Based off the error message, it looks like the project is not building properly.

Could you host your project on GitHub, so we can take a closer look? Also, please provide the exact steps you took to build the project.

Best Regards,

Did you figure this out? I have run into the same problem.

Nuxt version: 3.9.0
@pdftron/pdfjs-express-viewer: 8.7.4
@pdftron/webviewer version: 10.6.0

I am having the same problem.

The files paths are correct with npm run dev and npx nuxi build.

If I use npx nuxi generate, the file paths are incorrect.
localhost:3000/core/webviewer-core.min.js // missing webviewer before core
localhost:3000/webviewer/webviewer-ui.min.js // missing ui after webviewer

If I copy the public/webviewer/core folder to public/core and the public/webviewer/ui files to public/webviewer and run npx nuxi generate the pdf viewer works. I would prefer not to need two copies of the files in my public folder.

I also tried this Nuxt tutorial and it is the exact same problem (and “solution”).

Hi there,

Could you please provide a minimal sample project along with setup instructions? This could be a download or a GitHub Repo.

Thank you.

Here’s the code in a GitHup Repo. Let me know if you have any questions.

Hi there,

Apologies for the delay. It looks like may have something to do with the routing in your application. If you take a look at the network tab in the production build, you can see the ui returns the entry point (index.html) of your application instead of the correct JS file.