[Git][ghc/ghc][master] wasm: prevent bundlers from resolving import("node:timers")
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Jan 15 23:47:48 UTC 2025
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f6493dbc by amesgen at 2025-01-15T18:47:23-05:00
wasm: prevent bundlers from resolving import("node:timers")
This fixes the following esbuild error:
✘ [ERROR] Could not resolve "node:timers"
www/ghc_wasm_jsffi.js:66:25:
66 │ return (await import("node:timers")).setImmediate;
╵ ~~~~~~~~~~~~~
The package "node:timers" wasn't found on the file system but is built into node. Are you trying
to bundle for node? You can use "--platform=node" to do that, which will remove this error.
Previously (i.e. after !13503), one had to work around this by passing
`--external:node:timers`.
- - - - -
1 changed file:
- utils/jsffi/prelude.mjs
Changes:
=====================================
utils/jsffi/prelude.mjs
=====================================
@@ -63,7 +63,9 @@ const setImmediate = await (async () => {
// deno
if (globalThis.Deno) {
- return (await import("node:timers")).setImmediate;
+ try {
+ return (await import("node:timers")).setImmediate;
+ } catch {}
}
// https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6493dbccc7bf95dcdf946b978e262f739e3e15a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6493dbccc7bf95dcdf946b978e262f739e3e15a
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250115/f0c745f4/attachment.html>
More information about the ghc-commits
mailing list