-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Labels
enhancementNew feature or requestNew feature or requestfeat: wasmp2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Description
Clear and concise description of the problem
Hey! This is a feature request to add support for wasm-bindgen, a library to facilitate high-level interactions between Wasm modules and JavaScript for Rust.
wasm-bindgen has several output formats for generating Wasm <-> JS glue code, which most notably are web and bundler. I was hoping that the bundlertarger would be compatible with Vitejs, but unfortunately it's not. The output for the bundler target roughly looks like this:
// app.js
import * as wasm from "./app_bg.wasm";
export * from "./app_bg.js";// app_bg.js
import * as wasm from './app_bg.wasm';
// ...
export function myWasmFunction() {
wasm.myWasmFunction();
}for this code:
async function main() {
const wasmModule = await import('./app');
wasmModule.myWasmFunction();Suggested solution
There should be an alternative way to bundle Wasm files, which also supports dynamic import function. Probably add this as an option to the serve and build command or if possible auto detect.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeat: wasmp2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Type
Projects
Status
Approved