wails: On v2.0.0 wails dev or build will fail if dist is not yet generated
Description
In pipelines, or when I devmy project for the first time, the frontend/dist directory doesn’t exists yet, or is empty. In such a sitution, wails devor wails build will choke before even building the front, because the embed directory is missing.
It used to not be a problem, started after upgrading to the latest v2.0.0.
To Reproduce
run wails dev
Expected behaviour
wails devor build should build the front end first and then build the go code and get the embed
Screenshots
No response
Attempted Fixes
No response
System Details
Scanning system - Please wait (this may take a long time)...Done.
System
------
OS: MacOS
Version: 12.4
ID: 21F79
Go Version: go1.19
Platform: darwin
Architecture: arm64
Wails
------
Version: v2.0.0
Dependency Package Name Status Version
---------- ------------ ------ -------
xcode command line tools N/A Installed 2395
npm N/A Installed 8.19.1
*upx N/A Available
*nsis
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (7 by maintainers)
if I’m not wrong, the
frontend/distfolder gets recreated during the build. so one simple solution is to simple populate it with a dummy file during binding generation if the folder is empty… to further simplify this, the dummy file could even be a.gitkeepwhich could always be generated. then the user is free to put it into gitAnd, on a side note, thanks a lot for building wails.
@stefpap I suspect your problem is more related to #1921.
Could you try to remove the GOOS/GOARCH from your command and just use ‘-platform windows/386’ ?
For refrence,this is how I do it: https://github.com/olup/lunii-admin/blob/main/embed-empty.go https://github.com/olup/lunii-admin/blob/main/embed.go
One solution is to scan the main.go source for the embed directly then just make the directory, the problem is that it might be in a different file. Another way is to do static analysis on the Bindings and remove the current bindings generation method. Considering we are aiming to support multiple windows that have the potential to have different assets, I’m more inclined to do the static analysis as the bindings should only ever exist in the main config
Or, just check in your dist directory.
There’s already a build tag involved for building the bindings it is:
bindingsSo you could use that in your case, but it would be great to have this addressed in a generic way for all users. Determining the folder is pretty hard and would involve static analysis, in some cases it could be maybe impossible.