-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix(desktop): make dev server port configuration more flexible #6947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
The following comment was made by an LLM, it may be inaccurate: ResultsNo duplicate PRs found (beyond the PR itself at #6947). The searches across multiple relevant keyword combinations returned only the PR itself. This suggests that:
This is a good sign — you can proceed with this PR without worrying about duplicate efforts. |
|
cc @Brendonovich can you take a look? i like the idea of this, i've had this bite me running multiple |
|
Rebasing to fix conflicts now... |
Without this patch, the desktop application requires a strict port configuration (port 1420) and hardcodes the devUrl in tauri.conf.json. This causes issues when the port is already in use during development. This is a problem because developers cannot easily run multiple instances or work around port conflicts without manual configuration changes. This patch solves the problem by removing the hardcoded devUrl from tauri.conf.json, setting strictPort to false in vite.config.ts to allow Vite to find an available port, and updating the Rust code to read the dev URL from the Tauri config or fall back to the default localhost:1420.
89d025a to
dc238fe
Compare
|
If Vite decides to use a port other than 1420, how does Tauri become aware of that? I don't think this change implements that. |
|
@Brendonovich wrote:
It does! I tested it and it works.
Easier but substantially less useful; then you still can't run multiple instances and might get other conflicts on that same port. |
|
@aspiers Can you detail how you've tested this? I ran |
|
@Brendonovich I've tested it in three ways: 1. Test it works as normal with no other Tauri app runningSelf-explanatory 2. Test conflict with other Tauri app already running
3. Test multiple OpenCode Desktop instances running at the same timeFollowing on from test 2 above:
|
|
@Brendonovich If it's not working for you on this PR branch, then I would make a wildly uninformed guess as a Tauri / OpenCode newb that maybe you're missing a build step? E.g. see #6780 (comment). |
|
Ah I think I know why it's working for you: Tauri's behaviour when |
|
Ok yeah that's what I expected - the webviews aren't connecting to the vite instances, theyre connecting to Tauri's internal dev server that's serving files from |
|
Ah, I see, thanks. Couldn't we make it dynamically set |
|
Afaik no since 1) |






Without this patch, the desktop application requires a strict port configuration (port 1420) and hardcodes the
devUrlintauri.conf.json. This causes issues when the port is already in use during development.This is a problem because developers cannot easily run multiple instances or work around port conflicts without manual configuration changes.
This patch solves the problem by removing the hardcoded
devUrlfromtauri.conf.json, settingstrictPorttofalseinvite.config.tsto allow Vite to find an available port, and updating the Rust code to read the dev URL from the Tauri config or fall back to the default localhost:1420.Closes #6943.