wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
25.34k stars 1.22k forks source link

App is a black screen after building but works fine in development #497

Closed artooro closed 4 years ago

artooro commented 4 years ago

Description

I just built a new Wails app using the Angular template. When running in dev mode using wails serve and npx ng serve it works great. But if I build it using wails build or wails build -p it is just a black window. There is nothing in standard output and I can't find any useful troubleshooting info in the console.

Screenshots Screen Shot 2020-09-09 at 09 07 10

System Details

Name Value
Wails Version v1.7.1
Go Version go1.15
Platform darwin
Arch amd64
GO111MODULE (Not Set)
GCC 4.2.1
Npm 6.14.7
Node v14.9.0

Additional context In development the app works fine in both Safari and Chrome. If there is a way for me to see any logs from the built app, that would be great to know and be documented.

leaanthony commented 4 years ago

What version of MacOS? 10.15.5 works fine:

image
leaanthony commented 4 years ago

v10.15.6

image
leaanthony commented 4 years ago

Can confirm wails build -p works too

artooro commented 4 years ago

@leaanthony yeah the raw template works fine, but the app I built from the template does not. I was hoping there would be some type of log from the built binary that would show me what is going on.

leaanthony commented 4 years ago

Ah, building with -d will dump logs when run from terminal

artooro commented 4 years ago

Ah thanks, I missed that flag. So with the debug logs everything looks nominal so unfortunately doesn't help me resolve the actual issue. I'll have to rip out pieces of my code until it's narrowed down.

artooro commented 4 years ago

Spoke too soon, looks like in debug mode it's also possible to open the javascript console in the app window, where I noticed this error. "Unhandled Navigation Error".

Screen Shot 2020-09-09 at 17 56 56

So would I be correct that angular routing does not work in a Wails app?

leaanthony commented 4 years ago

I can't really help you with an Angular issue, but what I can do is point you to how the Vue and React people do routing and perhaps there's a similar solution for Angular? https://wails.app/guides/

If you find the answer, we'll update the docs :+1:

artooro commented 4 years ago

@leaanthony found that enabling hash based routing fixes the problem, so I've submitted a pull request to update the template.

I now have another issue where an image asset isn't loading, but that's unrelated and probably something I'm doing wrong.