Compiling your application using wails build -d
will create a debug version of your application. This means the following:
-loglevel
flag when launching your applicationModify/create the following files in the .vscode
directory (create if it doesn’t exist) in the root of your project, replacing myapp
for your project binary name:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Wails: build debug",
"type": "go",
"request": "launch",
"mode": "exec",
"program": "${workspaceFolder}/build/myapp",
"preLaunchTask": "wails_debug_build",
"env": {},
"args": []
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "wails_debug_build",
"type": "shell",
"command": "wails build -d"
}
]
}
On Windows, the Webview component doesn’t have developer tools natively, however there are a couple of ways to attach a remote debugger:
It’s possible to use a little-known utility for attaching the IE dev tools to your application: IEChooser.exe (or F12Chooser.exe depending on your windows version). The steps to attach are:
C:\Windows\System32\F12\IEChooser.exe
(or F12Chooser.exe
)about: blank
Note: This video is high resolution. Best viewed full screen.
It’s possible to debug in Visual Studio by doing the following:
Install a recent version of Visual Studio (The free “Community” Edition is fine. The following steps are based on VS 2017). Make sure the “ASP.NET and web development” workload is selected in the installer;
Open Debug -> Attach to Process…;
Click Select… and choose Debug there code types: -> Script
Find and select the process of your Wails application in Available Pocesses;
Click Attach. The DOM Explorer and JavaSript Console should now show up. If not, open them in Debug -> Windows.
Many thanks to our friends over at DeskGap for this information!