wails: Hot Reload not working for backend changes on windows

Description

I’m using wails on windows and my code doenst hot reloads when I do changes in the backend .go files. If I pass a single file to the -reloaddirs it do work, but not for all files of my project. Any way I can archive this?

To Reproduce

  1. Create a project on windows
  2. Execute it with wails dev
  3. Change a .go file
  4. expect the code to do not a hot reload

Expected behaviour

The code should hot reload after the changes on the backend files

Screenshots

No response

Attempted Fixes

I’ve tried to use a bash command to list all my dirs, but this is not a very friendly way to do this, and the feature IS HERE, I just need to understand why it’s not working

System Details

# Wails
Version | v2.6.0

# System
┌──────────────────────────────────────┐
| OS           | Windows 10 Enterprise |
| Version      | 2009 (Build: 19045)   |
| ID           | 22H2                  |
| Go Version   | go1.20.6              |
| Platform     | windows               |
| Architecture | amd64                 |
└──────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version       |
| WebView2   | N/A          | Installed | 117.0.2045.43 |
| Nodejs     | N/A          | Installed | 18.17.1       |
| npm        | N/A          | Installed | 9.6.7         |
| *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!

Additional context

I don’t really know if it’s my project’s problem or a general one, but other people working on the same project also are not able to use hot reloads on .go file changes.

tnks in advance

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 16 (6 by maintainers)

Most upvoted comments

I’ll take a look this weekend 👍

Changes on the backend are not triggering a rebuild in my project either, also on windows

Modify the doWatcherLoop function in the file dev.go. When the watcher adds a new directory, skip it if the path contains frontend\wailsjs; otherwise, it will block at the watcher.Add method. Finally, recompile wails.exe. This resolves the issue where only one rebuild trigger was occurring.

I’ve found this to be true for Go files in directories above main.go.

In my wails.json in cmd/desktop/wails.json, I have this config value:

  "reloaddirs": "../../desktop"

I also have my entrypoint in the same directory cmd/desktop/main.go. Hot reload works for main.go, but not for any of my other Go files in ./desktop/ (sibling of ./cmd/). Is this expected?

Edit: It looks like this is an issue for subdirectories. Should reloaddirs be recursive?

does your project’s frontend package.json contain dependency of vite tool ?

This old issue maybe help, you can try it.

The hot reload is working well for frontend, but not for backend .go files changes