fix(deno_os): allow running WebWorker without snapshots (#28975)

This addresses [#28680](https://github.com/denoland/deno/issues/28680)
where the esm modules are not found when instantiating a WebWorker with
snapshots disabled.

This is an alternative solution to another PR,
https://github.com/denoland/deno/pull/28693
This commit is contained in:
Dan 2025-04-24 18:39:38 +01:00 committed by GitHub
parent 2eeccf1045
commit e612d572f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,7 +113,13 @@ deno_core::extension!(
ops::signal::op_signal_unbind,
ops::signal::op_signal_poll,
],
esm = ["30_os.js", "40_signals.js"],
// deno_os and deno_os_worker may be used interchangeably, ensure that all
// esm modules are given the same identifiers. This is important when
// using `WebWorker` without snapshotting.
esm = [
"ext:deno_os/30_os.js" = "30_os.js",
"ext:deno_os/40_signals.js" = "40_signals.js",
],
middleware = |op| match op.name {
"op_exit" | "op_set_exit_code" | "op_get_exit_code" =>
op.with_implementation_from(&deno_core::op_void_sync()),