diff --git a/dist-build/emscripten.sh b/dist-build/emscripten.sh index 92c63018..2b379f17 100755 --- a/dist-build/emscripten.sh +++ b/dist-build/emscripten.sh @@ -116,13 +116,16 @@ if [ "$DIST" = yes ]; then } }; Module.useBackupModule = function() { - var Module = _Module; - Object.keys(Module).forEach(function(k) { + var Module = {}; + $(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g') + Object.keys(_Module).forEach(function(k) { if (k !== 'getRandomValue') { - delete Module[k]; + delete _Module[k]; } }); - $(cat "${PREFIX}/lib/libsodium.asm.tmp.js" | sed 's|use asm||g') + Object.keys(Module).forEach(function(k) { + _Module[k] = Module[k]; + }); }; $(cat "${PREFIX}/lib/libsodium.wasm.tmp.js") }).catch(function() {