vue-go-wasm-loader
v1.0.1
Published
The vue plugin for go-wasm
Downloads
6
Readme
vue-go-wasm-loader
Easy way to write golang in vue.
Just write golang in vue compoment with wasm tag.
Install
First, we should install golang in our system. Please download and untar it into /usr/local/
directory.
You can also install in windows WSL(Windows Subsystem for Linux)
Second, link go program into system bin path or set /usr/local/go/bin
into PATH envirement variable.
# link go program into system bin path
ln -sf /usr/local/go/ /usr/bin/go
# set `/usr/local/go/bin` into PATH envirement variable
export PATH=$PATH:/usr/local/go/bin
You can also fellow this guide.
Third, install vue-go-wasm
npm install vue-go-wasm
Settings
Add this loader into vue's sub loader.
webpack.base.conf.js:
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
wasm: 'vue-go-wasm-loader'
}
},
If your project is create from vue-cli, please edit vue-loader.conf.js
.
vue-loader.conf.js:
loaders: { ... utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}) ,
wasm: 'vue-go-wasm-loader'
},
Start
This is an minilize vue wasm example
<template>
<div></div>
</template>
<script>
export default {
name: 'WASM'
}
</script>
<wasm lang="go">
package main
func main() {
println("Hello World!")
}
</wasm>
License
MIT