-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
I am working on porting Geant 4, physics simulator into Web Assembly. I will be downloading many huge datafiles so I figured out that manually creating emscripten datafiles with file packager might be great way to handle this problem.
Unfortunately, I have got into problem that I can't fix. Unfortunately, my project is quite modern and the only way I can load WASM is with modularize option - I can't pass global var as pre module.
Here is my data structure. I am using react with typescriprt. All data files and wasm binaries are inside public directory, hence I have to overwrite locateFile
function. WASM processig will be done inside web worker.
For the main Wasm import I am using such syntax:
import {default as MainModule} from "./geant4_wasm/geant4_wasm.js";
var preModule = {
...
}
var mod = MainModule(preModule);
I was trying to load file_packager's
js. output using importScripts function inside web worker with global variable syntax but for some reason, while using webpack it doesn't work - global variable is not transfered to the imported file - i tried logging inside preload files, it loads but without initialization preModule.
var preModule = {
....
}
var Module = preModule;
importScripts("/preload_G4EMLOW8.6.1.js"); // file loads but with empty Module
// I have to access public directory in this case since unimported files are not packed inside react package
I kindly ask for adding similar modularize option for file_packager as for emcc or for suggestion how could i solve my problem.