#WASM app inside Vite inside Tauri -- Sometimes works, sometimes random errors

10 messages · Page 1 of 1 (latest)

small flame
#

I'm trying to create a Tauri version of my web SPA written mostly in Vue.

I have a component written in Rust (a bevy game, more specifically), compiled to WASM, and linked into the project using vite-plugin-wasm-pack. It works fine on the web. It doesn't work on Tauri; loading the module (__wbg_init()) causes the attached error. Everything else works fine.

My google-fu couldn't find anything on this. is it a missing feature in Tauri? Is there some magic config setting I couldn't find?

#

the code which starts the WASM app (inside a <script setup> inside a .vue file)

import wasm_init, { start as wasm_start } from "renderer";
wasm_init()
    .then(() => {
        renderer_loading.value = false;
        wasm_start();
    })
    .catch((e: Error) => {
        if (e.message.startsWith("Using exceptions for control flow")) {
            // a normal part of winit
            console.info("suppressing error: ", e.message);
        } else {
            console.error("caught error from wasm_init()");
            throw e;
        }
    });
#

ping me if replying please

#

i added a console.log before wasm_start() to check if the error is in wasm_init() or wasm_start()
and then it started working

#

so i commented out the console.log i just added and now it doesn't work again with a different error already borrowed: BorrowMutError

#

WASM app inside Vite inside Tauri -- Sometimes works, sometimes random errors

#

I restarted Tauri and now i got this error assertion failed: buckets.is_power_of_two()

#

panicked at 'called Option::unwrap() on a None value'

empty solar