Preface Compile frontend code into a desktop application using the Wails program in Go language.
Prerequisites
Download Wails Client 1 go install github.com/wailsapp/wails/v2/cmd/wails@latest
Download Frontend Project Template without Framework Other template links can be found in the official documentation. https://wails.io/zh-Hans/docs/community/templates/
-n <product_name>
: Specify the project name-t https://github.com/KiddoV/wails-pure-js-template.git
: Specify the template
https://github.com/KiddoV/wails-pure-js-template.git
is the template without a framework.
1 wails init -n <product_name> -t https://github.com/KiddoV/wails-pure-js-template.git
Project Structure
Place the frontend code in the frontend
directory
1 2 3 4 5 6 7 8 9 10 11 12 13 14 + <product_name> + build + bin # Compiled desktop applications + darwin # Configuration before compiling the Mac application + windows # Configuration before compiling the Windows application - appicon.png # Application icon - README.md + frontend # Place frontend code here - index.html - app.go - go.mod - main.go - README.md - wails.json
Package as a Desktop Application
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Wails CLI v2.6.0 # Build Options Platform(s) | darwin/arm64 Compiler | /opt/homebrew/bin/go Skip Bindings | false Build Mode | production Devtools | false Frontend Directory | ~/demo/frontend Obfuscated | false Skip Frontend | false Compress | false Package | true Clean Bin Dir | false LDFlags | Tags | [] Race Detector | false # Building target: darwin/arm64 • Generating bindings: Done. • No Install command. Skipping. • No Build command. Skipping. • Compiling application: Done. • Packaging application: Done. Built '~/<product_name>/build/bin/<product_name>.app/Contents/MacOS/<product_name>' in 1m2.34s. ♥ If Wails is useful to you or your company, please consider sponsoring the project:
Completion References Wails Official Documentation