panoptix-za / web-bundler

Bundles a Rust WebAssembly frontend application for publishing
Apache License 2.0
11 stars 3 forks source link

Does not work with latest version of wasm-bindgen #13

Open JWorthe opened 11 months ago

JWorthe commented 11 months ago

web-bundler inlines the javascript generated by wasm-bindgen and calls its init function.

https://github.com/panoptix-za/web-bundler/blob/main/src/lib.rs#L278C19-L278C19

    let javascript = format!(
        r#"<script type="module">{} init('{}'); </script>"#,
        package_js_content,
        wasm_path.display()
    );

Unfortunately it looks like in wasm-bindgen 0.2.85 it no longer generates a function named init.

Both before and after, the init function is exported as the default export of the javascript module that wasm-bindgen generates, so web-bunder should use that instead.