Skip to content

Commit e56e36b

Browse files
committed
lib: fix TypeScript support check in jitless mode
WebAssembly is disabled when Node.js is run with --jitless. The internal TypeScript stripper relies on WebAssembly, and previously failed obscurely in this mode. This commit ensures that assertTypeScript explicitly checks for the presence of WebAssembly and throws ERR_WEBASSEMBLY_NOT_SUPPORTED when it is unavailable. This change also documents the new error code and incorporates a regression test into test/es-module/test-typescript.mjs.
1 parent 1409ac4 commit e56e36b

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

doc/api/errors.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3350,6 +3350,12 @@ The WASI instance has already started.
33503350

33513351
The WASI instance has not been started.
33523352

3353+
<a id="ERR_WEBASSEMBLY_NOT_SUPPORTED"></a>
3354+
3355+
### `ERR_WEBASSEMBLY_NOT_SUPPORTED`
3356+
3357+
WebAssembly is not supported.
3358+
33533359
<a id="ERR_WEBASSEMBLY_RESPONSE"></a>
33543360

33553361
### `ERR_WEBASSEMBLY_RESPONSE`

lib/internal/errors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,7 @@ E('ERR_VM_MODULE_NOT_MODULE',
19051905
'Provided module is not an instance of Module', Error);
19061906
E('ERR_VM_MODULE_STATUS', 'Module status %s', Error);
19071907
E('ERR_WASI_ALREADY_STARTED', 'WASI instance has already started', Error);
1908+
E('ERR_WEBASSEMBLY_NOT_SUPPORTED', 'WebAssembly is not supported', Error);
19081909
E('ERR_WEBASSEMBLY_RESPONSE', 'WebAssembly response %s', TypeError);
19091910
E('ERR_WORKER_INIT_FAILED', 'Worker initialization failure: %s', Error);
19101911
E('ERR_WORKER_INVALID_EXEC_ARGV', (errors, msg = 'invalid execArgv flags') =>

lib/internal/util.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const {
99
ErrorCaptureStackTrace,
1010
FunctionPrototypeCall,
1111
FunctionPrototypeSymbolHasInstance,
12+
globalThis,
1213
NumberParseInt,
1314
ObjectDefineProperties,
1415
ObjectDefineProperty,

0 commit comments

Comments
 (0)