markdown-wasm icon indicating copy to clipboard operation
markdown-wasm copied to clipboard

TypeError: Cannot set property exports of undefined

Open aminya opened this issue 4 years ago • 0 comments

I am trying to use this package inside Atom, which is an Electron app. I used the following code to load and instantiate the wasm module asynchronously because Electron doesn't allow compiling large wasm files on the main thread.

  if (markdown_parse === undefined) {
    // wasm should be loaded async
    // @ts-ignore
    const markdown_wasm = (await import("markdown-wasm/dist/markdown.es")) as typeof import("markdown-wasm") & {
      ready: Promise<void>
    }
    // instantiate wasm
    await markdown_wasm.ready
    markdown_parse = markdown_wasm.parse
  }

I use Rollup as my compiler.

However, when I bundle the application I get these errors:

TypeError: Cannot set property exports of undefined

image

image

image

aminya avatar Jul 01 '21 09:07 aminya