Replies: 1 comment
-
|
@loryruta Can you create a reproducible repository? Want to see your configuration, thank you |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to understand how to bundle an app with webpack.
This app depends on a library (of mine) which in turns depends on .js+.wasm files coming from Emscripten compilation.
My project structure is the following:
The module.mjs and module.wasm are Emscripten's output and are compiled with
MODULARIZE=1,EXPORT_ES6=1.The setup I've given to
libraryis good for me as it enables the user to depend onlibraryby using ES6 imports.However, when the library is used on the web, for several reasons I would like to bundle the library using webpack.
I don't have preference over the output (one file vs multiple files), even having one single
bundle.jsfile would be fine, just I'd like to see it working.I'm facing several issues:
webpack.IgnorePluginto avoid following any import arose frommodule.mjs.Now the output is
bundle.js,js_lib_module-wasm_js.bundle.js,<hash>.wasm.module.mjsdoesn't try to start the web worker. I've discovered webpack replacesimport.meta.urlwith the path of the original file (e.g.file://<parent>/node_modules/library/module.mjs), and not the webpack's output bundle, and thus the call tonew Worker(new URL("file://<parent>/node_modules/library/module.mjs"))fails.I'm asking for any quick fix to this issue, but most importantly: isn't there a working example of app + ES6 Emscripten module?
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions