wails icon indicating copy to clipboard operation
wails copied to clipboard

[V3 Bugs] Developing on two projects simultaneously, since their frontend URLs are fixed, will lead to accessing the wrong page

Open fakecore opened this issue 1 year ago • 5 comments

Description

Wails 3 uses localhost:5173 as the fixed URL. When I open two Wails projects, both projects will direct to the same page.

To Reproduce

  1. Change directory to wails3_project_A.
  2. Run wails3 dev. (frontend listen on localhost:5173)
  3. Change directory to wails3_project_B.
  4. Run wails3 dev. (frontend listen on localhost:5174)
  5. A: Show the page belonging to project A. (connect to localhost:5173)
  6. B: Show the page belonging to project A. (connect to localhost:5173)

Expected behaviour

A: Show the page belonging to project A. (connect to localhost:5173) B: Show the page belonging to project B. (connect to localhost:5174)

Screenshots

No response

Attempted Fixes

No response

System Details

Wails Doctor



# System
┌──────────────────────────────┐
| Name          | MacOS        |
| Version       | 14.4.1       |
| ID            | 23E224       |
| Branding      | Sonoma       |
| Platform      | darwin       |
| Architecture  | arm64        |
| Apple Silicon | true         |
| CPU           | Apple M1 Pro |
| CPU           | Unknown      |
| GPU           | Unknown      |
| Memory        | Unknown      |
└──────────────────────────────┘

# Build Environment
┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-alpha.4                           |
| Go Version   | go1.22.1                                 |
| Revision     | cf130a6e2564426b2ab222598cd452e68e8a62bd |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOARCH       | arm64                                    |
| GOOS         | darwin                                   |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | cf130a6e2564426b2ab222598cd452e68e8a62bd |
| vcs.time     | 2024-04-06T03:38:43Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────────────┐
| Xcode cli tools | 2406                                                 |
| npm             | 10.2.4                                               |
| *NSIS           | Not Installed. Install with `brew install makensis`. |
└─────────────────────── * - Optional Dependency ────────────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

Additional context

No response

fakecore avatar Apr 07 '24 09:04 fakecore

If possible, I would like to try to fix it. Do you have any suggestions for this bug?

fakecore avatar Apr 07 '24 09:04 fakecore

It uses whatever url you give it: FRONTEND_DEVSERVER_URL: 'http://localhost:5173'

https://github.com/wailsapp/wails/blob/cf130a6e2564426b2ab222598cd452e68e8a62bd/v3/internal/templates/_common/Taskfile.tmpl.yml#L438

leaanthony avatar Apr 07 '24 11:04 leaanthony

Wails cannot detect the correct frontend port. For example, I opened a project running on port 5173. When running the Wails project, the frontend port will run on 5174. However, the backend still connects to port 5173.

fakecore avatar Apr 08 '24 02:04 fakecore

Can wails support the dynamic port?

fakecore avatar Apr 08 '24 02:04 fakecore

It will be better than vite can read this env FRONTEND_DEVSERVER_URL: 'http://localhost:5175' to set the frontend port.

fakecore avatar Apr 08 '24 09:04 fakecore