wasmerio / webassembly.sh

Open-source and installable PWA terminal powered by WebAssembly, WAPM, and Wasmer-JS 🖥
https://webassembly.sh
MIT License
286 stars 31 forks source link

Build Fails (SOLVED) #96

Open sfranzyshen opened 3 years ago

sfranzyshen commented 3 years ago

My development environment:

next ... $ preact build --no-prerender

ERROR Can't find self.__WB_MANIFEST in your SW source.

the work around here was to add "self.__WB_MANIFEST" to the src/sw.js file as follows ... change the first line in the file ... from: self.__precacheManifest = [].concat(self.__precacheManifest || []); to: self.__precacheManifest = [].concat(self.__precacheManifest || [self.__WB_MANIFEST]);

next ... $ preact build --no-prerender and finally I got a build ... next I kicked off a local web server and loaded the page ...

$ cd build
$ python3 -m http.server 8000
127.0.0.1 - - [15/Jul/2021 00:16:57] "GET /assets/wasm-terminal/xterm.css HTTP/1.1" 404 -
127.0.0.1 - - [15/Jul/2021 00:17:09] "GET /assets/wasm-terminal/process.worker.js HTTP/1.1" 404 -

the work around here was to copy the xterm.css & process.worker.js files into the build/assets folder

$ mkdir assets/wasm-terminal
$ cp ../node_modules/@wasmer/wasm-terminal/lib/workers/process.worker.js assets/wasm-terminal/
$ cp ../node_modules/xterm/css/xterm.css assets/wasm-terminal/

I also copied these files into the src/assets folder so subsequent builds have them ...

$ mkdir ../src/assets/wasm-terminal
$ cp ../node_modules/@wasmer/wasm-terminal/lib/workers/process.worker.js ../src/assets/wasm-terminal/
$ cp ../node_modules/xterm/css/xterm.css ../src/assets/wasm-terminal/

finally got it working ... $ python3 -m http.server 8000

Hope this helps someone else ... and perhaps show light onto problems for the developers ...

john-sharratt commented 2 years ago

Thanks @sfranzyshen - this was super helpful