-
Notifications
You must be signed in to change notification settings - Fork 10k
Add Workers Emscripten Instructions and Gotchas #23945
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
base: production
Are you sure you want to change the base?
Conversation
I spent two days figuring out how to get Emscripten WASM modules working in PartyKit, assembled from old Discord messages and abandoned example repos with out-dated WASM import mechanisms. The instructions here represent the cleanest and most useful way to get Emscripten modules working in Cloudflare Workers and Durable Objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds documentation for using Emscripten-compiled WebAssembly modules in Cloudflare Workers. The documentation addresses specific compilation flags and instantiation patterns needed to work around Workers' runtime limitations.
Key changes:
- Adds Emscripten-specific compilation flags and requirements
- Provides a code example for proper module instantiation in Workers
- References an example template repository
src/content/docs/workers/runtime-apis/webassembly/javascript.mdx
Outdated
Show resolved
Hide resolved
src/content/docs/workers/runtime-apis/webassembly/javascript.mdx
Outdated
Show resolved
Hide resolved
src/content/docs/workers/runtime-apis/webassembly/javascript.mdx
Outdated
Show resolved
Hide resolved
Add Suggestions from Github Actions Co-authored-by: Copilot <[email protected]>
Switch from async/await to then/catch syntax to be called from the top level.
|
Hi @irvinebroque |
Summary
I spent two days figuring out how to get Emscripten WASM modules working in PartyKit, assembled from old Discord messages and abandoned example repos with out-dated WASM import mechanisms.
The instructions here represent the cleanest and most useful way to get Emscripten modules working in Cloudflare Workers and Durable Objects.
This example can be seen in production using an Emscripten compilation of the
manifoldCSG library in a PartyKit server for doing shared multiplayer CSG operations:https://zalo.github.io/WorldParty/
https://github.com/zalo/WorldParty/blob/main/src/server.js#L82-L92
Documentation checklist