Skip to content

Conversation

@zalo
Copy link

@zalo zalo commented Jul 24, 2025

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 manifold CSG 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

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.
Copilot AI review requested due to automatic review settings July 24, 2025 22:47
@github-actions github-actions bot added the product:workers Related to Workers product label Jul 24, 2025
Copy link
Contributor

Copilot AI left a 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

zalo and others added 2 commits July 24, 2025 15:49
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.
@zalo
Copy link
Author

zalo commented Aug 4, 2025

Hi @irvinebroque
@mikenomitch
@GregBrimble
@WalshyDev
@kodster28
@korinne I think this addition to the documentation clarifies a long-standing issue with WebAssembly on Workers, and enables a large ecosystem of Emscripten modules to be used within Workers and Durable Objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants