Skip to content

Commit 4ef0f76

Browse files
committed
fix: call module initializer to setup externref table
1 parent 29386b3 commit 4ef0f76

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

worker-build/src/js/shim.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,42 @@ const instance = new WebAssembly.Instance(wasmModule, {
1010
imports.__wbg_set_wasm(instance.exports);
1111

1212
// Run the worker's initialization function.
13-
imports.start?.();
13+
instance.exports.__wbindgen_start?.();
1414

1515
export { wasmModule };
1616

1717
class Entrypoint extends WorkerEntrypoint {
18-
async fetch(request) {
19-
return await imports.fetch(request, this.env, this.ctx)
20-
}
18+
async fetch(request) {
19+
return await imports.fetch(request, this.env, this.ctx);
20+
}
2121

22-
async queue(batch) {
23-
return await imports.queue(batch, this.env, this.ctx)
24-
}
22+
async queue(batch) {
23+
return await imports.queue(batch, this.env, this.ctx);
24+
}
2525

26-
async scheduled(event) {
27-
return await imports.scheduled(event, this.env, this.ctx)
28-
}
26+
async scheduled(event) {
27+
return await imports.scheduled(event, this.env, this.ctx);
28+
}
2929
}
3030

3131
const EXCLUDE_EXPORT = [
32-
"IntoUnderlyingByteSource",
33-
"IntoUnderlyingSink",
34-
"IntoUnderlyingSource",
35-
"MinifyConfig",
36-
"PolishConfig",
37-
"R2Range",
38-
"RequestRedirect",
39-
"fetch",
40-
"queue",
41-
"scheduled",
42-
"getMemory"
32+
"IntoUnderlyingByteSource",
33+
"IntoUnderlyingSink",
34+
"IntoUnderlyingSource",
35+
"MinifyConfig",
36+
"PolishConfig",
37+
"R2Range",
38+
"RequestRedirect",
39+
"fetch",
40+
"queue",
41+
"scheduled",
42+
"getMemory",
4343
];
4444

45-
Object.keys(imports).map(k => {
46-
if (!(EXCLUDE_EXPORT.includes(k) | k.startsWith("__"))) {
47-
Entrypoint.prototype[k] = imports[k];
48-
}
49-
})
45+
Object.keys(imports).map((k) => {
46+
if (!(EXCLUDE_EXPORT.includes(k) | k.startsWith("__"))) {
47+
Entrypoint.prototype[k] = imports[k];
48+
}
49+
});
5050

51-
export default Entrypoint;
51+
export default Entrypoint;

worker-sandbox/wrangler.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ main = "./shim.mjs"
6868
[[build.upload.rules]]
6969
globs = ["**/*.wasm"]
7070
type = "CompiledWasm"
71+
72+
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
73+
dwarf-debug-info = true

0 commit comments

Comments
 (0)