Skip to content

fix(ext/node): implement worker_threads.isInternalThread#35234

Merged
bartlomieju merged 2 commits into
mainfrom
fix/worker-threads-is-internal-thread
Jun 15, 2026
Merged

fix(ext/node): implement worker_threads.isInternalThread#35234
bartlomieju merged 2 commits into
mainfrom
fix/worker-threads-is-internal-thread

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

node:worker_threads did not implement isInternalThread, so both the
named import and the property on the default/require object were
missing:

import { isInternalThread } from "node:worker_threads";
// error: Uncaught SyntaxError: The requested module
// 'node:worker_threads' does not provide an export named
// 'isInternalThread'

isInternalThread was added in Node v23.7.0 / v22.14.0. It is a boolean
indicating whether the code runs inside an internal Node worker thread
(such as a module loader thread), as distinct from isMainThread. It is
false in the main thread and in user-created workers.

In the polyfill the synthetic ESM export names are derived from the keys
of the exports object, so adding isInternalThread there exposes it both
as a named export and as a property of the default/require object.
Deno has no internal Node worker threads, so the value is a constant
false.

Closes #35149

node:worker_threads did not export isInternalThread (added in Node
v23.7.0 / v22.14.0), so both the named import and the property on the
default/require object were missing. Add it to the exports object with a
constant value of false, since Deno has no internal Node worker threads.

Closes #35149
@bartlomieju
bartlomieju merged commit 2c5b34f into main Jun 15, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the fix/worker-threads-is-internal-thread branch June 15, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:worker_threads does not implement (and exports) isInternalThread

1 participant