-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix using loro in cloudflare worker (#441)
* fix: try fix generated wasm bundler * fix: loro-quill example and fix bundler patch issue * chore: add release info
- Loading branch information
Showing
5 changed files
with
46 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"loro-wasm": patch | ||
"loro-crdt": patch | ||
--- | ||
|
||
Make loro-wasm work in cloudflare worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// See https://github.com/loro-dev/loro/issues/440 | ||
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function" | ||
import * as wasm from "./loro_wasm_bg.wasm"; | ||
import * as imports from "./loro_wasm_bg.js"; | ||
|
||
if (wasm.__wbindgen_start) { | ||
imports.__wbg_set_wasm(wasm); | ||
wasm.__wbindgen_start(); | ||
} else { | ||
const wkmod = await import("./loro_wasm_bg.wasm"); | ||
const instance = new WebAssembly.Instance(wkmod.default, { | ||
"./loro_wasm_bg.js": imports, | ||
}); | ||
imports.__wbg_set_wasm(instance.exports); | ||
} | ||
export * from "./loro_wasm_bg.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters