Closed misitebao closed 2 years ago
Hi @misitebao thanks for this report, seems to me like a duplicate of #1357.
Connecting directly to Vite will never work, wails can't inject the runtime/bindings there. If you want to develop in a browser, please open the Wails DevServer which is per default on localhost:34115
@stffabi @leaanthony
If so, what's the point of frontend:dev:serverUrl
? And visit localhost:34115
, when the front-end code is updated, the UI will not be automatically updated.😢
Since the introduction of frontend:dev:serverUrl
Wails now fully supports external devserver and will reverse proxy to the external dev server. So by specifying the frontend:dev:serverUrl
you can use wails dev
and you get a fully automatically reloading dev experience by using e.g. vite. You can also browse to localhost:34115
which will also do auto reloads.
Just use one of the vite powered templates and you have a fully auto reload dev experience. You can either use wails directly and see auto reloads there, or you can browse with your browser to localhost:34115
and see auto reloads there as soon as the frontend code gets changed and vite has triggered the reload.
@stffabi
When running wails dev
, the front end will start the development server and generate resources in the virtual directory. It stands to reason that files should not be generated in the dist
directory, but the wails dev
command seems to also execute the command in frontend:build
, and resource files are generated in the dist
directory.
That's not a problem since wails dev
will use the vite dev server
to show the frontend.
I think building frontend assets to dist
directory in vite dev
mode is redundant step and should only be done when executing vite build
command in frontend:dev:watcher
or frontend:dev
will generate the frontend to the dist
directory, what do you think?
@stffabi
There are three scenarios in my understanding of wails dev
:
frontend:dev
, e.g. "frontend:dev":"npm run build -mode development"
frontend:dev:watcher
, e.g. "frontend:dev:watcher":"npm run build --watch -mode development"
frontend:dev:watcher
and frontend:dev:serverUrl
, e.g. "frontend:dev:watcher":"npm run dev" and "frontend:dev:serverUrl": "http://localhost:3000"
Is it right?👀
I personally see no problem with those two redundant calls.
Edit: Having an empty frontend:dev
will always fallback to frontend:build
.
It seems that this step is not required in wails dev
mode?
Could be but that might be a breaking change. I would suggest to open a new issue if you see a problem with that, since we got quite off-topic of this issue.
For discussion of the issues mentioned above, please move to https://github.com/wailsapp/wails/discussions/1384
Description
With dev watcher mode, bound go methods cannot be used in the console.
To Reproduce
wails dev
localhost:3000
in the browserExpected behaviour
Binding Go methods can be accessed in the browser console.
Screenshots
No response
Attempted Fixes
No response
System Details
Additional context
No response