$ sudo npm install -g preact-cli
(clone or download this project's repository)
$ cd webassembly.sh/
$ npm install
$ preact build
Unable to read file: /mnt/d/WASM/webassembly.sh-master/src/node_modules/@wasmer/wasm-terminal/lib/optimized/wasm-terminal.esm.js
the work around was to create a symbolic link in the src/ folder to point to node_modules/
$ cd src
$ ln -s ../node_modules/ node_modules
$ cd ..
$ preact build
ReferenceError: window is not defined
the work around here was to use the command line switch "--no-prerender" but this occurs
when evaluating a non-existent variable (window) ... the code should be change to use "typeof". typeof won't try to evaluate "window", it will only try to get its type ... for example in src/index.js it test the value of window in a if call ... and it should test for "typeof"
from:
if (window)
to:
if (typeof window !== "undefined")
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 ...
My development environment:
Unable to read file: /mnt/d/WASM/webassembly.sh-master/src/node_modules/@wasmer/wasm-terminal/lib/optimized/wasm-terminal.esm.js
the work around was to create a symbolic link in the src/ folder to point to node_modules/
ReferenceError: window is not defined
the work around here was to use the command line switch "--no-prerender" but this occurs when evaluating a non-existent variable (window) ... the code should be change to use "typeof". typeof won't try to evaluate "window", it will only try to get its type ... for example in src/index.js it test the value of window in a if call ... and it should test for "typeof" from:
if (window)
to:if (typeof window !== "undefined")
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 ...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
I also copied these files into the src/assets folder so subsequent builds have them ...
finally got it working ...
$ python3 -m http.server 8000
Hope this helps someone else ... and perhaps show light onto problems for the developers ...