Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix environment detection in web worker #103

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

andrewbranch
Copy link
Contributor

Fixes #102

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

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

@guybedford
Copy link
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