mupdf-js icon indicating copy to clipboard operation
mupdf-js copied to clipboard

[BUG] CompileError running client side

Open rawsh opened this issue 2 years ago • 6 comments

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.

rawsh avatar Apr 19 '23 19:04 rawsh

hi @rawsh , were you able to fix it?

siduck avatar May 11 '23 13:05 siduck

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

rawsh avatar May 11 '23 17:05 rawsh

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

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

siduck avatar May 11 '23 23:05 siduck

Yep I think it's a nextJS issue

rawsh avatar May 12 '23 18:05 rawsh

Are there any news on this?

tgdn avatar Oct 03 '23 11:10 tgdn

@tgdn no, i stopped using this

siduck avatar Oct 03 '23 12:10 siduck