Description
Problem
Applications built using wails build fail to start when frontend:dir is not the default value. Using wails dev works completely fine. It is highly likely that the frontend's built assets are not being embedded in the application since in this case they reside in an unexpected directory. Tested on Windows 10 but likely affects other platforms.
Proof
By inserting this code before the attempt to call wails.Run, one can check for the presence of frontend assets in a console window when built with -windowsconsole:
dir := "frontend/dist"
entries, _ := assets.ReadDir(dir)
log.Printf("Files in assets %q dir: %d", dir, len(entries))
time.Sleep(time.Second * 15) // Leaves the console open long enough to see the issue
Result with a fresh project: 2026/03/01 19:35:40 Files in assets "frontend/dist" dir: 2 (index.html and assets dir)
Result with a renamed frontend: 2026/03/01 19:37:02 Files in assets "frontend/dist" dir: 1 (gitkeep)
Recommended Fix
In v2/pkg/commands/build/build.go, immediately after the call to builder.BuildFrontend and its error check, while still inside that skip check if-block:
if options.ProjectData.GetFrontendDir() != "frontend" {
if options.SkipEmbedCreate {
// Warn that the frontend's build couldn't be copied as creating the target embed folder was skipped.
} else {
frontendDistDir := fmt.Sprintf("%s/dist", options.ProjectData.GetFrontendDir())
// Copy frontendDistDir to "frontend/dist"
}
}
After finishing the build, delete all files in frontend/dist except gitkeep.
To Reproduce
- Inside a blank folder, create a simple Wails app using
wails init -n client.
- Verify the app runs both with
wails dev and wails build. Both should work as expected.
- Rename the
frontend directory to jsfrontend.
- Add
"frontend:dir": "./jsfrontend", to wails.json.
- Run using
wails dev, which should work.
- Build with
wails build and attempt to run the executable. This should fail to open.
- Move
jsfrontend outside the client folder and rename to frontend.
- Change
frontend:dir to "../frontend".
- Run using
wails dev, which should work.
- Build with
wails build and attempt to run the executable. This should fail to open.
Expected behaviour
Where a Wails project's frontend:dir is not the default value, the application should successfully build and start.
Screenshots
No response
Attempted Fixes
This is an issue within Wails v2. There is no external fix, though one workaround exists in a specific set of circumstances.
Possible Workarounds
For frontends that remain inside the wails project's directory, the embed directive for the assets can be changed from //go:embed all:frontend/dist to //go:embed all:<frontend:dir value>/dist
There is, however, NO workaround for frontends which are outside of the Wails project's directory, as the go:embed directive does not allow paths that begin with ., .., or /.
System Details
> wails doctor
Wails Doctor
# Wails
Version | v2.11.0
# System
┌──────────────────────────────────────────────────────────────────────────────────────────────┐
| OS | Windows 10 Pro |
| Version | 2009 (Build: 19045) |
| ID | 22H2 |
| Branding | Windows 10 Pro |
| Go Version | go1.22.2 |
| Platform | windows |
| Architecture | amd64 |
| CPU | AMD Ryzen 9 7950X3D 16-Core Processor |
| GPU | AMD Radeon RX 7900 XTX (Advanced Micro Devices, Inc.) - Driver: 32.0.21032.24 |
| Memory | 64GB |
└──────────────────────────────────────────────────────────────────────────────────────────────┘
# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version |
| WebView2 | N/A | Installed | 145.0.3800.82 |
| Nodejs | N/A | Installed | 24.12.0 |
| npm | N/A | Installed | 11.6.2 |
| *upx | N/A | Available | |
| *nsis | N/A | Available | |
| |
└─────────────── * - Optional Dependency ───────────────┘
# Diagnosis
Optional package(s) installation details:
- upx : Available at https://upx.github.io/
- nsis : More info at https://wails.io/docs/guides/windows-installer/
SUCCESS Your system is ready for Wails development!
♥ If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
Additional context
No response
Description
Problem
Applications built using
wails buildfail to start whenfrontend:diris not the default value. Usingwails devworks completely fine. It is highly likely that the frontend's built assets are not being embedded in the application since in this case they reside in an unexpected directory. Tested on Windows 10 but likely affects other platforms.Proof
By inserting this code before the attempt to call
wails.Run, one can check for the presence of frontend assets in a console window when built with-windowsconsole:Result with a fresh project:
2026/03/01 19:35:40 Files in assets "frontend/dist" dir: 2(index.html and assets dir)Result with a renamed frontend:
2026/03/01 19:37:02 Files in assets "frontend/dist" dir: 1(gitkeep)Recommended Fix
In
v2/pkg/commands/build/build.go, immediately after the call tobuilder.BuildFrontendand its error check, while still inside that skip check if-block:After finishing the build, delete all files in
frontend/distexceptgitkeep.To Reproduce
wails init -n client.wails devandwails build. Both should work as expected.frontenddirectory tojsfrontend."frontend:dir": "./jsfrontend",towails.json.wails dev, which should work.wails buildand attempt to run the executable. This should fail to open.jsfrontendoutside theclientfolder and rename tofrontend.frontend:dirto"../frontend".wails dev, which should work.wails buildand attempt to run the executable. This should fail to open.Expected behaviour
Where a Wails project's
frontend:diris not the default value, the application should successfully build and start.Screenshots
No response
Attempted Fixes
This is an issue within Wails v2. There is no external fix, though one workaround exists in a specific set of circumstances.
Possible Workarounds
For frontends that remain inside the wails project's directory, the embed directive for the assets can be changed from
//go:embed all:frontend/distto//go:embed all:<frontend:dir value>/distThere is, however, NO workaround for frontends which are outside of the Wails project's directory, as the
go:embeddirective does not allow paths that begin with.,.., or/.System Details
Additional context
No response