You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
Describe the bug
Attempting to get emscripten wasm working with Sapper. The wasm files are from Google Sqoosh but it can be any emscripten wasm file.
Emscripten generated code uses fs, but on the client-side you can use webpack.IgnorePlugin so app avoids fs and the whole thing works https://github.com/hepiBatman/webpack-wasm-emscripten.
Sapper, on the other hand, by default is server-side rendering, causing to use fs library to load wasm and causing error because it does not file the wasm files.
Logs
{ Error: ENOENT: no such file or directory, open 'mozjpeg_enc.93395.wasm'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.shell_read [as read] (webpack:///./wasm/mozjpeg_enc.js?:8:1239)
at Object.readBinary (webpack:///./wasm/mozjpeg_enc.js?:8:1357)
at getBinary (webpack:///./wasm/mozjpeg_enc.js?:8:14410)
at eval (webpack:///./wasm/mozjpeg_enc.js?:8:14931)
at new Promise (<anonymous>)
at getBinaryPromise (webpack:///./wasm/mozjpeg_enc.js?:8:14885)
at instantiateArrayBuffer (webpack:///./wasm/mozjpeg_enc.js?:8:15859)
at doNativeWasm (webpack:///./wasm/mozjpeg_enc.js?:8:16477)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'mozjpeg_enc.93395.wasm' }
failed to asynchronously prepare wasm: abort({"errno":-2,"code":"ENOENT","syscall":"open","path":"mozjpeg_enc.93395.wasm"}). Build with -s ASSERTIONS=1 for more info.
abort({"errno":-2,"code":"ENOENT","syscall":"open","path":"mozjpeg_enc.93395.wasm"}). Build with -s ASSERTIONS=1 for more info.
abort("abort({\"errno\":-2,\"code\":\"ENOENT\",\"syscall\":\"open\",\"path\":\"mozjpeg_enc.93395.wasm\"}). Build with -s ASSERTIONS=1 for more info."). Build with -s ASSERTIONS=1 for more info.
webpack:///./wasm/mozjpeg_enc.js?:8
var Module=typeof mozjpeg_enc!=="undefined"?mozjpeg_enc:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){scriptDirectory=__dirname+"/";var nodeFS;var
abort("abort(\"abort({\\\"errno\\\":-2,\\\"code\\\":\\\"ENOENT\\\",\\\"syscall\\\":\\\"open\\\",\\\"path\\\":\\\"mozjpeg_enc.93395.wasm\\\"}). Build with -s ASSERTIONS=1 for more info.\"). Build with -s ASSERTIONS=1 for more info."). Build with -s ASSERTIONS=1 for more info.
> Server crashed
Describe the bug
Attempting to get emscripten wasm working with Sapper. The wasm files are from Google Sqoosh but it can be any emscripten wasm file.
Emscripten generated code uses fs, but on the client-side you can use webpack.IgnorePlugin so app avoids fs and the whole thing works https://github.com/hepiBatman/webpack-wasm-emscripten.
Sapper, on the other hand, by default is server-side rendering, causing to use fs library to load wasm and causing error because it does not file the wasm files.
Logs
From https://github.com/sveltejs/sapper/issues/383, I have followed https://github.com/timhall/sapper-spa but it appears this is only for the view.
To Reproduce
https://github.com/hepiBatman/svelte-wasm-emscripten
Expected behavior
Sapper to allow wasm emscripten to work.
Information about your Sapper Installation:
Your browser and the version: Chrome 76.0.3809.100
Your operating system: OS X 10
Your hosting environment: Local
Sapper version: latest
Svelte version: latest
If it is an exported (npm run export) or dynamic application.: dynamic
Whether your application uses Webpack or Rollup: Webpack
Severity
Unable to develop app with Svelte wasm emscripten.
The text was updated successfully, but these errors were encountered: