Skip to content

Safari doesn't like `import("node:timers")`

In the javascript file we generate with the post-link.mjs there's import("node:timers") statement. Safari 16.1 on Apple devices cannot process it and errors out with

[blocked] The page at https://pointfree-wasm.github.io/ was not allowed to run insecure content from node:timers.

The problematic import statement is part of the following block:

  try {
    // deno
    return (await import("node:timers")).setImmediate;
  } catch {
    // browsers
    const sm = new SetImmediate();
    return (cb, ...args) => sm.setImmediate(cb, ...args);
  }