Skip to content

Fix environment detection in web worker#103

Merged
guybedford merged 1 commit intonodejs:mainfrom
andrewbranch:bug/web-worker
Aug 29, 2024
Merged

Fix environment detection in web worker#103
guybedford merged 1 commit intonodejs:mainfrom
andrewbranch:bug/web-worker

Conversation

@andrewbranch
Copy link
Copy Markdown
Contributor

Fixes #102

@guybedford guybedford merged commit 0f605c4 into nodejs:main Aug 29, 2024
@andrewbranch andrewbranch deleted the bug/web-worker branch August 29, 2024 00:54
@andrewbranch
Copy link
Copy Markdown
Contributor Author

@guybedford thanks! Is there a particular release cadence to npm for this library?

@guybedford
Copy link
Copy Markdown
Collaborator

@andrewbranch thinking about this more I'm not quite sure this is the right fix still actually - in a cloudflare worker, we'd hit the condition despite Buffer being defined.

So I'm tempted to say the check should actually be based on typeof Buffer !== 'undefined'.

Further, we should probably default to using typeof crypto !== 'undefined' && typeof crypto.subtle !== 'undefined' at this point in time as well now I think too?

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.

getWasmBytes crashes in web worker

2 participants