1.0.4 • Published 2 years ago

@xyh19/rollup-plugin-wasm v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Rollup plugin to bundle wasm module. Support assemblyScript, emscripten, golang. Support vite.

🏠 Homepage

install

npm i -D @xyh19/rollup-plugin-wasm
# or
yarn add -D @xyh19/rollup-plugin-wasm

Getting Started

Create a rollup.config.js configuration file and import the plugin:

// rollup.config.js
import wasm from '@xyh19/rollup-plugin-wasm'
import path from 'path'

export default {
  input: 'src/index.js',
  output: {
    dir: 'output',
    format: 'cjs',
  },
  plugins: [
    wasm(),
  ],
}

Configuration

inline

  • Type: boolean | number | ((fileName: string, id: string) => boolean | Promise<boolean>)

Inline webassembly directly in source code.

useInstanceFactory(experimental)

  • Type: boolean | CustomWebAssemblyInstanceFactory

debug(experimental)

  • Type: boolean Enable debug mode.

target

  • Type: undefined | 'node'

asc

AssemblyScript compile.

emscripten(experimental)

Emscripten compile.

golang

golang compile.

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!