Skip to content

Commit 9fadda0

Browse files
committed
Add a dirty preprocess
... to workaround a compatibility problem between Vite and Emscripten. emscripten-core/emscripten#22394 vitejs/vite#18396
1 parent 0c7dd94 commit 9fadda0

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

demo/build/build-sl.sh

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ emcc \
3030
-Lncurses-6.4/usr/local/lib \
3131
-lncurses \
3232
-ltinfo
33+
34+
sh worker-options-hack.sh ../static/sl-core.js

demo/build/build-sloane.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010

1111
emcc \
1212
-Os \
13-
-D"main(k,Z)=int main(int k,char**Z)" \
13+
-D"main(k,Z)=int main(k,Z)int k;" \
1414
-include stdio.h \
1515
-include math.h \
1616
-s EXPORT_ES6 \
@@ -22,3 +22,5 @@ emcc \
2222
-o ../static/sloane-core.js \
2323
-Wno-implicit-int \
2424
sloane.c
25+
26+
sh worker-options-hack.sh ../static/sloane-core.js

demo/build/worker-options-hack.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
sed -i 's/var workerOptions=\({[^}]*}\);\(worker=new Worker(new URL("[^"]*",import\.meta\.url),\)workerOptions\()\)/\2\1\3/g' $1

0 commit comments

Comments
 (0)