Skip to content

Conversation

@Han5991
Copy link
Contributor

@Han5991 Han5991 commented Jan 14, 2026

The internal TypeScript stripper relies on WebAssembly, which is disabled in --jitless mode. This PR updates
assertTypeScript to explicitly throw ERR_WEBASSEMBLY_NOT_SUPPORTED instead of failing obscurely when WebAssembly
is unavailable.

A regression test has been added to test/es-module/test-typescript.mjs.

image

Fixes: #61353

@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Jan 14, 2026
@Han5991 Han5991 force-pushed the fix-jitless-typescript-error branch from 202f642 to e56e36b Compare January 14, 2026 13:27

### `ERR_WEBASSEMBLY_NOT_SUPPORTED`

WebAssembly is not supported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message does not really add much. We should specify that the internal requires webassembly to be enabled, and therefore cannot be used in environments where its not present such as when running with --jitless

Copy link
Member

@marco-ippolito marco-ippolito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is not performing any check, it just added an error that is not used anywhere. The error should be thrown when lazily initializing the typescript parser

@Han5991
Copy link
Contributor Author

Han5991 commented Jan 14, 2026

This PR is not performing any check, it just added an error that is not used anywhere. The error should be thrown when lazily initializing the typescript parser

Thanks for the feedback. I'll review the logic and move the check to the appropriate place as suggested. I will also improve the error message to be more descriptive.

@Han5991 Han5991 force-pushed the fix-jitless-typescript-error branch 2 times, most recently from 08c7bc7 to e6cb215 Compare January 14, 2026 14:06

The WASI instance has not been started.

<a id="ERR_WEBASSEMBLY_NOT_SUPPORTED"></a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name ERR_WEBASSEMBLY_NOT_SUPPORTED incorrect, the issue is that web assembly is required and not present

'Provided module is not an instance of Module', Error);
E('ERR_VM_MODULE_STATUS', 'Module status %s', Error);
E('ERR_WASI_ALREADY_STARTED', 'WASI instance has already started', Error);
E('ERR_WEBASSEMBLY_NOT_SUPPORTED', 'WebAssembly is not supported', Error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the error message should be improve, we should also pass which feature is trying to need it (like typescript)

*/
const loadTypeScriptParser = getLazy(() => {
assertTypeScript();
if (WebAssembly === undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably go in assertTypeScript

@Han5991 Han5991 force-pushed the fix-jitless-typescript-error branch from bf1ec67 to ca857df Compare January 14, 2026 14:38
WebAssembly is disabled when Node.js is run with --jitless. The
internal TypeScript stripper relies on WebAssembly, and previously
failed obscurely with a ReferenceError in this mode.

This commit adds an explicit check for WebAssembly support when
loading the TypeScript parser. If WebAssembly is unavailable,
it now throws a descriptive ERR_WEBASSEMBLY_NOT_SUPPORTED error.

Fixes: nodejs#61353
@Han5991 Han5991 force-pushed the fix-jitless-typescript-error branch from ca857df to ef5444a Compare January 14, 2026 14:44
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (903f647) to head (ef5444a).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61382      +/-   ##
==========================================
- Coverage   88.54%   88.53%   -0.01%     
==========================================
  Files         704      704              
  Lines      208793   208800       +7     
  Branches    40307    40312       +5     
==========================================
- Hits       184866   184854      -12     
- Misses      15913    15924      +11     
- Partials     8014     8022       +8     
Files with missing lines Coverage Δ
lib/internal/errors.js 97.62% <100.00%> (+<0.01%) ⬆️
lib/internal/util.js 96.53% <100.00%> (-0.28%) ⬇️

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

errors Issues and PRs related to JavaScript errors originated in Node.js core. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When Node.js is run with Amaro, but also with --jitless flag error message about lack of WebAssembly global could be more descriptive

3 participants