Emscripten FS when emitting ES6 mjs

Viewed 140

When I compile with emcc --bind -lworkerfs.js -o pmread.js pmread.cpp -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 The program works fine,

But if I emit ES6 module using emcc --bind -lworkerfs.js -o pmread.mjs pmread.cpp -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 Since the mjs only has default export on Module FS is not available. How do I use Emscripten's File System FS when emitting ES& module?

I have tried changing to Named export in pmread.mjs and export {Module, FS} But the Web Worker refuse to load Thanks

1 Answers

Solved by emitting pmread.js and append export {Module,FS,WORKERFS} at the end

Related