0.1.5 • Published 3 years ago

@fuyoo/vite-plugin-inject-wasm v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vite-plugin-inject-wasm

vite@2 plugin to inject wasm!

Note: this plugin only works serve

how to use

  1. install
pnpm install @fuyoo/vite-plugin-inject-wasm
  1. config plugin at the vite.config.ts
import {defineConfig} from 'vite'
import {VitePluginInjectWasm} from '@fuyoo/vite-plugin-inject-wasm'

export default defineConfig({
    plugins: [vue(), VitePluginInjectWasm([{
        name: "@fuyoo/wasm-hasher", // this is package name
        where: "pkg/wasm_hasher_bg.wasm" // **.wasm file's relative path in the package
    }]
})
  1. use wasm package at .vue files npm create vite@latest my-vue-app -- --template vue
<script setup>
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
import hasher from "@fuyoo/wasm-hasher"
hasher().then(pkg => {
  console.log(pkg)
})
</script>

<template>
    <h1>hello vite-plugin-inject-wasm<h1>
</template>
  1. at .ts or .js file
import hasher from "@fuyoo/wasm-hasher"
hasher().then(pkg => {
  console.log(pkg)
})

LICENSE

MIT LICENSE

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago