Skip to content

Support cloudflare worker runtime #22

Open
@enpitsuLin

Description

@enpitsuLin

Currently, the WASM files are embedded as gzipped base64 strings in the module. However, this approach is not compatible with Cloudflare Workers runtime and causes errors when using Wrangler.

image

Cloudflare Workers only supports direct WASM imports. cloudflare/workers-sdk#1366

As a workaround, I've implemented a solution by:

  1. Dumping WASM from hardcoded values
  2. Adding a polyfill for loadWasm logic

like:
image

While this works for basic WASM modules, it doesn't work properly for RSA implementations that depend on rsa_bg.js. I haven't found a solution for this besides using package patches.

Would it be possible to provide the raw WASM files instead of embedding them as gzipped base64 strings? This would improve compatibility with bundlers that support WASM directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions