Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/update-emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ emcc -O3 -I ../include *.c -DH3_HAVE_VLA --memory-init-file 0 \
for file in *.js ; do
# Patch libh3 bundle to contain a fix to allow h3-js to be imported in a web worker and react-native
# See #117 and #163 for more details.
# Also patch __dirname for ESM environments (Cloudflare Workers, Node ESM, Deno, Bun)
# See #216 for more details.
cat ../../../../build/pre.js "$file" \
| sed 's/if(document.currentScript)/if(typeof document!=="undefined" \&\& document.currentScript)/g' \
| sed 's/scriptDirectory=__dirname+"\/"/scriptDirectory=typeof __dirname!=="undefined"?__dirname+"\/":""/g' \
> ../../../../out/"$file"
done

Expand Down