Skip to content

Commit 18980b7

Browse files
committed
wasm: Avoid registering uncaught exception/rejection handlers
1 parent 751ffd2 commit 18980b7

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

script/build-wasm

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ EOF
3030
set -e
3131

3232
web_dir=lib/binding_web
33-
exports=$(cat ${web_dir}/exports.json)
3433
emscripten_flags="-O3"
3534
minify_js=1
3635
force_docker=0
@@ -79,25 +78,27 @@ mkdir -p target/scratch
7978

8079
# Use emscripten to generate `tree-sitter.js` and `tree-sitter.wasm`
8180
# in the `target/scratch` directory
82-
$emcc \
83-
-s WASM=1 \
84-
-s TOTAL_MEMORY=33554432 \
85-
-s ALLOW_MEMORY_GROWTH=1 \
86-
-s MAIN_MODULE=2 \
87-
-s NO_FILESYSTEM=1 \
88-
-s "EXPORTED_FUNCTIONS=${exports}" \
89-
$emscripten_flags \
90-
-std=c99 \
91-
-D 'fprintf(...)=' \
92-
-D NDEBUG= \
93-
-I lib/src \
94-
-I lib/include \
95-
--js-library ${web_dir}/imports.js \
96-
--pre-js ${web_dir}/prefix.js \
97-
--post-js ${web_dir}/binding.js \
98-
--post-js ${web_dir}/suffix.js \
99-
lib/src/lib.c \
100-
${web_dir}/binding.c \
81+
$emcc \
82+
-s WASM=1 \
83+
-s TOTAL_MEMORY=33554432 \
84+
-s ALLOW_MEMORY_GROWTH=1 \
85+
-s MAIN_MODULE=2 \
86+
-s NO_FILESYSTEM=1 \
87+
-s NODEJS_CATCH_EXIT=0 \
88+
-s NODEJS_CATCH_REJECTION=0 \
89+
-s EXPORTED_FUNCTIONS=@${web_dir}/exports.json \
90+
$emscripten_flags \
91+
-std=c99 \
92+
-D 'fprintf(...)=' \
93+
-D NDEBUG= \
94+
-I lib/src \
95+
-I lib/include \
96+
--js-library ${web_dir}/imports.js \
97+
--pre-js ${web_dir}/prefix.js \
98+
--post-js ${web_dir}/binding.js \
99+
--post-js ${web_dir}/suffix.js \
100+
lib/src/lib.c \
101+
${web_dir}/binding.c \
101102
-o target/scratch/tree-sitter.js
102103

103104
# Use terser to write a minified version of `tree-sitter.js` into

0 commit comments

Comments
 (0)