A sample project that uses Tinygo WASM and Typescript. To get started with this project install:
- Yarn - installation instructions
- Tinygo - installation instructions
Then when installed you can build the project with:
make install
make all
We use React, and Typescript for a simple web interface. We have built our own webpack build configuration to allow us to circumvent the opinionated build system of CRA and enable the use of Go WASM files.
The core calculations in the widget are done using webassembly. Tinygo is required to be installed. The wasm file can be compiled as follows:
tinygo build -o ../server/dist/wasm.wasm -target wasm main.go
A simple go based web server that uses the air module to do live reloads. The server can be started with the following:
air
Air is pretty awesome for rapid development with Go. Check it out: Air.
To set this up one must have Tinygo installed and must update the location to the wasm_exec.js file. This will be in a path such as on mac and needs to be copied into the server/dist directory:
cp /usr/local/Cellar/tinygo/0.15.0/targets/wasm_exec.js server/dist
For this project I have copied my wasm_exec.js file into the client/src directory; it then gets built into the final project.
This project only exists because of the following articles: