Hello, I wrote a post about this some weeks ago. I recommend using *.mjs* modules, otherwise you will need to polyfill a lot of things in webpack.
Here the posts, I hope they are useful (second one is full focused on webpack but the guide is about programming Wasm module in Vusial Studio): https://www.wasm.builders/khanon/building-a-c-wasm-module-in-visual-studio-57m7 https://www.wasm.builders/khanon/consuming-visual-studio-c-wasm-module-from-webpack-project-13p3 El martes, 25 de octubre de 2022 a las 20:27:59 UTC+2, aitha...@gmail.com escribió: > I have also used *-sMODULARIZE *and exported the Module to webpack, but > when using optimization of -O3 .mem file is being created, webpack is > unable to load this *.mem (memory initializer) file*, any solution for > this > > On Tuesday, October 25, 2022 at 9:43:01 PM UTC+5:30 Aitha Tarun wrote: > >> Normally I use script tag in html file to attach emscripten generated JS. >> But how to import this emscripten (emcc) generated JS file in webpack. >> >> I am using below command to build the javascript file: >> *emcc ./src/rfb.c -o ./src/js/rfb.js -sWASM=0 --pre-js ./src/js/pre.js >> -sEXPORTED_FUNCTIONS=_main,_malloc >> -sEXPORTED_RUNTIME_METHODS=FS,callMain,cwrap,wasmMemory -sASYNCIFY -O3 >> -sENVIRONMENT=web* >> >> And I have using directly *import './js/rfb.js';* >> *But Module object is not getting created when html file is opened in >> browser.* >> >> -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/a6e52cbb-b1c2-4028-b289-ea771abc95e0n%40googlegroups.com.