| Crates.io | rolldown_plugin_wasm_helper |
| lib.rs | rolldown_plugin_wasm_helper |
| version | 0.1.0 |
| created_at | 2025-10-18 05:20:41.858545+00 |
| updated_at | 2025-10-18 05:20:41.858545+00 |
| description | Rolldown plugin for WebAssembly helper generation |
| homepage | https://rolldown.rs/ |
| repository | https://github.com/rolldown/rolldown |
| max_upload_size | |
| id | 1888837 |
| size | 84,762 |
A plugin for rolldown-vite that helps load .wasm?init files by converting them into proper JavaScript initialization code, ported from Vite's wasmHelperPlugin.
This plugin is exclusive to rolldown-vite and is not recommended for external use.
This plugin enables the loading of .wasm?init imports by creating a wrapper JavaScript module that initializes the WebAssembly module at runtime.
It uses a virtual helper module (\0vite/wasm-helper.js) to handle the instantiation and setup of the WebAssembly module.
import init from './module.wasm?init';
init().then(instance => {
// use instance.exports...
});
Will be transformed to something like:
import initWasm from '\0vite/wasm-helper.js';
export default opts => initWasm(opts, 'assets/module-HASH.wasm');
import { defineConfig } from 'rolldown';
import { wasmHelperPlugin } from 'rolldown/experimental';
export default defineConfig({
input: {
entry: './main.ts',
},
plugins: [wasmHelperPlugin()],
});