andytango/mupdf-js

[BUG] CompileError running client side

rawsh opened this issue · 6 comments

rawsh commented

Describe the bug
When instantiating the library on a NextJS client component I'm getting web assembly errors.

To Reproduce
Steps to reproduce the behavior:

  • Call createMuPdf on a nextjs client component

Log output
Initially fails trying to import FS. If you mock out FS with the following web pack config

webpack(config, { webpack, isServer }) {
    if (!isServer) {
      config.resolve.fallback = {
        fs: false
      }
    }
    return config;
  },

Then the import works, but you get the following when instantiating mupdf.

RuntimeError: abort(CompileError: WebAssembly.Module doesn't parse at byte 0: module doesn't start with '\0asm'). Build with -s ASSERTIONS=1 for more info.
siduck commented

hi @rawsh , were you able to fix it?

rawsh commented

@siduck I ended up giving up and parsing docs on the server side

siduck commented

@siduck I ended up giving up and parsing docs on the server side

ive tried mupdf-js with vite, works like a charm man

rawsh commented

Yep I think it's a nextJS issue

tgdn commented

Are there any news on this?

siduck commented

@tgdn no, i stopped using this