Skip to content

fix(templates): add server.host 127.0.0.1 to all v3 vite configs#5361

Merged
leaanthony merged 3 commits into
masterfrom
fix-vite-host-5348
May 10, 2026
Merged

fix(templates): add server.host 127.0.0.1 to all v3 vite configs#5361
leaanthony merged 3 commits into
masterfrom
fix-vite-host-5348

Conversation

@leaanthony

@leaanthony leaanthony commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Added server.host: "127.0.0.1" to all 20 v3 template vite configs (vanilla, vue, svelte, sveltekit, react, react-swc, solid, qwik, preact, lit — both plain and -ts variants)
  • Fixes newly created wails3 init projects failing to load on systems where localhost resolves to ::1 (IPv6)

Root Cause

PR #5265 (alpha.79) forces tcp4 when Wails connects to the Vite dev server, but Vite's default localhost can resolve to ::1 (IPv6) on macOS and Windows. Explicitly binding Vite to 127.0.0.1 ensures it listens on IPv4 so the tcp4 connection succeeds.

Closes #5348

Summary by CodeRabbit

  • Chores
    • Updated development server configuration across framework templates. The dev server now binds exclusively to localhost (127.0.0.1), restricting network accessibility during development.

Since alpha.79, Wails forces tcp4 when connecting to the Vite dev server,
which breaks on systems where localhost resolves to ::1 (IPv6).
Setting server.host to 127.0.0.1 ensures Vite listens on IPv4.

Closes #5348

Co-authored-by: multica-agent <github@multica.ai>
Copilot AI review requested due to automatic review settings May 7, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the v3 project templates’ Vite configuration to explicitly bind the dev server to IPv4 loopback (127.0.0.1), preventing wails3 init + wails3 dev projects from failing to load on systems where localhost resolves to IPv6 (::1) while Wails connects via IPv4 (tcp4).

Changes:

  • Added server.host: "127.0.0.1" to all v3 Vite-based templates’ vite.config.* files.
  • Integrated the host setting into existing server config blocks (e.g., SvelteKit) without otherwise altering template behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
v3/internal/templates/vue/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/vue-ts/frontend/vite.config.ts Same as above for Vue TS template.
v3/internal/templates/vanilla/frontend/vite.config.js Same as above for Vanilla template.
v3/internal/templates/vanilla-ts/frontend/vite.config.ts Same as above for Vanilla TS template.
v3/internal/templates/sveltekit/frontend/vite.config.js Adds host to existing server block (keeps fs allow rules).
v3/internal/templates/sveltekit-ts/frontend/vite.config.ts Same as above for SvelteKit TS template.
v3/internal/templates/svelte/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/svelte-ts/frontend/vite.config.ts Same as above for Svelte TS template.
v3/internal/templates/solid/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/solid-ts/frontend/vite.config.ts Same as above for Solid TS template.
v3/internal/templates/react/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/react-ts/frontend/vite.config.ts Same as above for React TS template.
v3/internal/templates/react-swc/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/react-swc-ts/frontend/vite.config.ts Same as above for React SWC TS template.
v3/internal/templates/qwik/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/qwik-ts/frontend/vite.config.ts Same as above for Qwik TS template.
v3/internal/templates/preact/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/preact-ts/frontend/vite.config.ts Same as above for Preact TS template.
v3/internal/templates/lit/frontend/vite.config.js Bind Vite dev server to 127.0.0.1 for IPv4 loopback.
v3/internal/templates/lit-ts/frontend/vite.config.ts Same as above for Lit TS template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ace0a4a7-2c45-4fdd-8a92-12fdf0cb7094

📥 Commits

Reviewing files that changed from the base of the PR and between 3294a6b and 5333769.

📒 Files selected for processing (20)
  • v3/internal/templates/lit-ts/frontend/vite.config.ts
  • v3/internal/templates/lit/frontend/vite.config.js
  • v3/internal/templates/preact-ts/frontend/vite.config.ts
  • v3/internal/templates/preact/frontend/vite.config.js
  • v3/internal/templates/qwik-ts/frontend/vite.config.ts
  • v3/internal/templates/qwik/frontend/vite.config.js
  • v3/internal/templates/react-swc-ts/frontend/vite.config.ts
  • v3/internal/templates/react-swc/frontend/vite.config.js
  • v3/internal/templates/react-ts/frontend/vite.config.ts
  • v3/internal/templates/react/frontend/vite.config.js
  • v3/internal/templates/solid-ts/frontend/vite.config.ts
  • v3/internal/templates/solid/frontend/vite.config.js
  • v3/internal/templates/svelte-ts/frontend/vite.config.ts
  • v3/internal/templates/svelte/frontend/vite.config.js
  • v3/internal/templates/sveltekit-ts/frontend/vite.config.ts
  • v3/internal/templates/sveltekit/frontend/vite.config.js
  • v3/internal/templates/vanilla-ts/frontend/vite.config.ts
  • v3/internal/templates/vanilla/frontend/vite.config.js
  • v3/internal/templates/vue-ts/frontend/vite.config.ts
  • v3/internal/templates/vue/frontend/vite.config.js

Walkthrough

All 20 Vite configuration files in the template suite are updated to explicitly set the dev server host to 127.0.0.1, restricting the development server to bind to the loopback interface instead of the default behavior.

Changes

Vite Dev Server Host Configuration

Layer / File(s) Summary
Dev Server Host Binding
v3/internal/templates/lit-ts/frontend/vite.config.ts, v3/internal/templates/lit/frontend/vite.config.js, v3/internal/templates/preact-ts/frontend/vite.config.ts, v3/internal/templates/preact/frontend/vite.config.js, v3/internal/templates/qwik-ts/frontend/vite.config.ts, v3/internal/templates/qwik/frontend/vite.config.js, v3/internal/templates/react-swc-ts/frontend/vite.config.ts, v3/internal/templates/react-swc/frontend/vite.config.js, v3/internal/templates/react-ts/frontend/vite.config.ts, v3/internal/templates/react/frontend/vite.config.js, v3/internal/templates/solid-ts/frontend/vite.config.ts, v3/internal/templates/solid/frontend/vite.config.js, v3/internal/templates/svelte-ts/frontend/vite.config.ts, v3/internal/templates/svelte/frontend/vite.config.js, v3/internal/templates/sveltekit-ts/frontend/vite.config.ts, v3/internal/templates/sveltekit/frontend/vite.config.js, v3/internal/templates/vanilla-ts/frontend/vite.config.ts, v3/internal/templates/vanilla/frontend/vite.config.js, v3/internal/templates/vue-ts/frontend/vite.config.ts, v3/internal/templates/vue/frontend/vite.config.js
Every Vite configuration across all 10 framework templates (and their TypeScript and JavaScript variants) now includes server: { host: "127.0.0.1" } to bind the dev server explicitly to localhost.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰 A thousand configs, twenty strong,
All bound to 127.0.0.1 where they belong,
From React to Vue, from Lit to Svelte too,
Localhost whispers: "This one's just for you!"
🎯✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description provides a clear summary and root cause analysis, but doesn't follow the template's formal structure with explicit issue reference and testing/checklist sections. Provide explicit 'Fixes #' format and complete testing checklist sections to fully align with the provided template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding server.host 127.0.0.1 to all v3 vite configs.
Linked Issues check ✅ Passed The changes directly address issue #5348 by ensuring Vite binds to IPv4 (127.0.0.1) instead of allowing IPv6 (::1) resolution, fixing failed connections with Wails' tcp4 requirement.
Out of Scope Changes check ✅ Passed All 20 file changes consistently apply the same fix (adding server.host: 127.0.0.1) across all v3 template vite configs with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-vite-host-5348

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leaanthony leaanthony enabled auto-merge (squash) May 10, 2026 02:42
@leaanthony leaanthony disabled auto-merge May 10, 2026 02:47
@leaanthony leaanthony merged commit 4808836 into master May 10, 2026
19 of 21 checks passed
@leaanthony leaanthony deleted the fix-vite-host-5348 branch May 10, 2026 02:47
phoenixsheppard28 pushed a commit to phoenixsheppard28/wails that referenced this pull request May 10, 2026
…): add server.host 127.0.0.1 to all v3 vite configs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v3] alpha.85 version wails init newly created program cannot run normally

3 participants