Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Locally built canvaskit-wasm doesn't work

23 views
Skip to first unread message

Miguel Camba

unread,
Mar 11, 2025, 1:24:57 PMMar 11
to skia-discuss
I wonder if this may be a basic thing, but so far I failed miserably at building canvaskit-wasm and using it locally.

I followed the instructions, cloned and built emscripten, added to the path, pulled all external dependencies and I can run " make release" in /modules/canvaskit-wasm and it finishes without errors.
But when I change my code to use this custom built version instead of the ones published in npm, when I run my app (which has been using skia for a couple of years no) it fails to render the animations. The errors seem to steam from the wasm compilation. This is one of the errors I get in the dev tools. There are more but all very similar.

```
canvaskit-wasm_bin_f….js?v=e6f599f1:3510 wasm streaming compile failed: LinkError: WebAssembly.instantiate(): Import #217 "a" "bd": function import requires a callable
```

Am I missing some crucial step?

Miguel Camba

unread,
Mar 12, 2025, 9:19:12 AMMar 12
to skia-discuss
Ok, I was kind of wrong. That error seems it was dure to canvaskit.js and canvaskit.wasm not matching. I was trying to load canvaskit using ES import (I'm on a vite project) which works with the npm package but doesn't work when importing the generated file from the project itself. IDK if it's some vite configuration or because the version built for publishing in the NPM registry is compiled differently.

Either way, I can load the custom built canvaskit if I include inside a script tag on my index. I've been testing different builds, removing packages I don't need to make it smaller. The webGPU build may have some quirks but those might be for me, as I'm referencing webgl context in a few places.

Reply all
Reply to author
Forward
0 new messages