Package Exports
- @napi-rs/wasm-tools
- @napi-rs/wasm-tools/browser.js
- @napi-rs/wasm-tools/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@napi-rs/wasm-tools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@napi-rs/wasm-tools
https://github.com/rustwasm/walrus bindings
Install this package
pnpm add @napi-rs/wasm-tools -D
yarn add @napi-rs/wasm-tools -D
Usage
// Generate dwarf info and emit wasm
import { join } from 'node:path'
import { readFile, writeFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { ModuleConfig } from '@napi-rs/wasm-tools'
const __dirname = join(fileURLToPath(import.meta.url), '..')
const wasm = await readFile(join(__dirname, 'panic.wasm32-wasi.wasm'))
const binary = new ModuleConfig()
.generateDwarf(true)
.generateNameSection(true)
.generateProducersSection(true)
.preserveCodeTransform(true)
.parse(wasm)
.emitWasm(true)
await writeFile(join(__dirname, 'panic.wasm32-wasi.wasm'), binary)