rolldown_plugin_wasm_helper

Crates.iorolldown_plugin_wasm_helper
lib.rsrolldown_plugin_wasm_helper
version0.1.0
created_at2025-10-18 05:20:41.858545+00
updated_at2025-10-18 05:20:41.858545+00
descriptionRolldown plugin for WebAssembly helper generation
homepagehttps://rolldown.rs/
repositoryhttps://github.com/rolldown/rolldown
max_upload_size
id1888837
size84,762
Boshen (Boshen)

documentation

README

Maintenance Guide

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.

📦 What it does

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.

✅ Examples

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');

🚀 Debug Usage

import { defineConfig } from 'rolldown';
import { wasmHelperPlugin } from 'rolldown/experimental';

export default defineConfig({
  input: {
    entry: './main.ts',
  },
  plugins: [wasmHelperPlugin()],
});
Commit count: 6097

cargo fmt