website/docs/guides/manual-builds.mdx
The Wails CLI does a lot of heavy lifting for the project, but sometimes it's desirable to manually build your project. This document will discuss the different operations the CLI does and how this may be achieved in different ways.
When either wails build or wails dev are used, the Wails CLI performs a common build process:
- Install frontend dependencies
- Build frontend project
- Generate build assets
- Compile application
- [optional] Compress application
-s flag is given, this step is skippedwails.json to see if there is an install command in the key frontend:installpackage.json exists in the frontend directory. If it doesn't exist, it skips this steppackage.json file contentspackage.json.md5 and if it exists, will compare the contents of it (an MD5 sum)
with the one generated to see if the contents have changed. If they are the same, this step is skippedpackage.json.md5 does not exist, it creates it using the generated MD5 sumnode_modules does not exist, or the -f flag is given, the install command is
executed in the frontend directoryThis step could be done from the command line or a script with npm install.
-s flag is given, this step is skippedwails.json to see if there is a build command in the key frontend:buildThis step could be done from the command line or a script with npm run build or whatever the frontend build script is.
-nopackage flag is set, this stage is skippedbuild/appicon.png file does not exist, a default one is createdbuild/windows/icon.ico does not exist, it will create it from the build/appicon.png image.build/windows/icon.ico does not exist, it will create it from build/appicon.png using icon sizes of 256, 128, 64, 48, 32 and 16. This is done using winicon.build/windows/<projectname>.manifest file does not exist, it creates it from a default version..syso file ready for linking.icon.ico using the winicon CLI tool (or any other tool)..manifest file for your application.syso file.-clean flag is provided, the build directory is deleted and recreatedwails dev, the following default Go flags are used: -tags dev -gcflags "all=-N -l"wails build, the following default Go flags are used: -tags desktop,production -ldflags "-w -s"
-ldflags "-w -h -H windowsgui"-tags are added to the defaults-ldflags are added to the defaults-o flag is passed through-compiler will be used for compilationgo build -tags dev -gcflags "all=-N -l"go build -tags desktop,production -ldflags "-w -s -H windowsgui".syso file-upx flag has been given, the upx program will be run to compress the application with the default settings-upxflags is also passed, these flags are used instead of the default onesupx [flags] manually to compress the application.