Skip to content

Conversation

korywka
Copy link

@korywka korywka commented Sep 17, 2025

Issue: #1372

The IS_WEBWORKER_ENV is true for Deno Worker runtime:

const IS_WEBWORKER_ENV = typeof self !== "undefined" && (['DedicatedWorkerGlobalScope', 'ServiceWorkerGlobalScope', 'SharedWorkerGlobalScope'].includes(self.constructor?.name));

So it is not reliable condition to check for HTML/Offscreen-Canvas API usage.

One way to fix it is to go from env-based conditions to feature-based.

If we add Deno condition to exclude Canvas API, it would work for now, but I think it will be broken for Node Workers (nodejs/node#43583) and Bun Web Workers.

Please note that this PR has been tested only with Deno, not other environments. It should be tested further, closed, or used as a starting point.

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.

1 participant