Skip to content
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

[bug] Tauri does not connect to vite dev server, displays white window #13017

Open
arihant2math opened this issue Mar 18, 2025 · 14 comments
Open
Labels
platform: Windows status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@arihant2math
Copy link

Describe the bug

localhost:1420 loads as expected, it's white but inspecting works, but the application window looks like this:

Image

The issue is that rightclicking doesn't work, the vite dev server doesn't acknowledge connection as it usually does.

Reproduction

No response

Expected behavior

The vite server to be connected to.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22635 x86_64 (X64)
    ✔ WebView2: 135.0.3179.11
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.85.0 (4d91de4e4 2025-02-17)
    ✔ cargo: 1.85.0 (d73d2caf9 2024-12-31)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 23.9.0
    - npm: 11.0.0
    - deno: deno 2.0.0

[-] Packages
    - tauri 🦀: 2.3.1
    - tauri-build 🦀: 2.0.6
    - wry 🦀: 0.50.5
    - tao 🦀: 0.32.8
    - @tauri-apps/api : 2.3.0
    - @tauri-apps/cli : 2.3.1

[-] Plugins
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : not installed!
    - tauri-plugin-shell 🦀: 2.2.0
    - @tauri-apps/plugin-shell : 2.2.0
    - tauri-plugin-dialog 🦀: 2.2.0
    - @tauri-apps/plugin-dialog : 2.2.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

Stack trace

None

Additional context

No response

@arihant2math arihant2math added status: needs triage This issue needs to triage, applied to new issues type: bug labels Mar 18, 2025
@FabianLars
Copy link
Member

Can you try this? #12975 (comment)

@EliottGaboreau
Copy link

I'm having the same kind of issue when creating a second window via the rust api. The additional browser args did not help.

@EliottGaboreau
Copy link

EliottGaboreau commented Mar 18, 2025

In case it might help, I reproduced the issue on my machine with this minimal example (I tested this on another mac os machine where it works as expected)

`tauri info output`
[✔] Environment
    - OS: Windows 10.0.19045 x86_64 (X64)
    ✔ WebView2: 133.0.3065.92
    ✔ MSVC: 
        - Visual Studio Build Tools 2022
        - Visual Studio Community 2022
    ✔ rustc: 1.85.0 (4d91de4e4 2025-02-17)
    ✔ cargo: 1.85.0 (d73d2caf9 2024-12-31)
    ✔ rustup: 1.28.1 (f9edccde0 2025-03-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.11.0
    - pnpm: 8.15.5
    - yarn: 1.22.21
    - npm: 10.2.4

[-] Packages
    - tauri 🦀: 2.3.1
    - tauri-build 🦀: 2.0.6   
    - wry 🦀: 0.50.5
    - tao 🦀: 0.32.8
    - @tauri-apps/api : 2.3.0
    - @tauri-apps/cli : 2.3.1

[-] Plugins
    - tauri-plugin-opener 🦀: 2.2.6     
    - @tauri-apps/plugin-opener : 2.2.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

I'm not sure whether this is exactly the same issue. I can create a new one if it seems relevant.

@BTMuli
Copy link

BTMuli commented Mar 19, 2025

The additional browser args did not help.

How about lock wry version to 0.50.3?

@huangmiuXyz
Copy link

It does not work when I lock my Wry version to 0.50.3. I'm using macOS

@vvhh2002
Copy link

vvhh2002 commented Mar 19, 2025

Image

'pnpm tauri dev' same blank window with error but it's ok when use release build.

[✔] Environment
- OS: Mac OS 10.15.7 x86_64 (X64)
✔ Xcode Command Line Tools: installed
✔ rustc: 1.85.0 (4d91de4e4 2025-02-17)
✔ cargo: 1.85.0 (d73d2caf9 2024-12-31)
✔ rustup: 1.28.1 (f9edccde0 2025-03-05)
✔ Rust toolchain: stable-x86_64-apple-darwin (default)
- node: 20.19.0
- pnpm: 10.5.2
- npm: 10.8.2
[-] Packages
- tauri 🦀: 2.3.1
- tauri-build 🦀: 2.0.6
- wry 🦀: 0.50.4
- tao 🦀: 0.32.2
- tauri-cli 🦀: 2.3.1
- @tauri-apps/api : 2.3.0
- @tauri-apps/cli : 2.3.1

[-] Plugins
- tauri-plugin-log 🦀: 2.2.0
- @tauri-apps/plugin-log : not installed!

[-] App
- build-type: bundle
- CSP: style-src 'unsafe-inline' 'self' https://fonts.googleapis.com; img-src 'self' asset: http://asset.localhost blob: data:; default-src 'self' customprotocol: asset:; connect-src ipc: http://ipc.localhost; font-src https://fonts.gstatic.com
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: Svelte
- bundler: Vite

@EliottGaboreau
Copy link

EliottGaboreau commented Mar 19, 2025

How about lock wry version to 0.50.3?

No luck on my side

Something else I forgot to mention, when closing the program with a ctrl+c I get this error message :

[0319/105104.822:ERROR:window_impl.cc(122)] Failed to unregister class Chrome_WidgetWin_0. Error = 1411

@BTMuli
Copy link

BTMuli commented Mar 19, 2025

[0319/105104.822:ERROR:window_impl.cc(122)] Failed to unregister class Chrome_WidgetWin_0. Error = 1411

The err is expected.
Do you create the window by windowBuilder or webviewWindowBuilder?
If by windowBuilder,you should create a webview and mount it to the window.

@EliottGaboreau
Copy link

EliottGaboreau commented Mar 19, 2025

I'm using WebviewWindowBuilder. Full code can be found here

@EliottGaboreau
Copy link

I'm not sure about how to proceed to further investigate this, I tried downgrading to specific tauri versions, 2.3.1, 2.3.0 2.2.5, 2.2.2 and even 2.1.1 all produced the same behavior for me so I'm thinking that, at least in my case, it might not be a regression as suggested by the timing of other similar reports but either a long standing bug or a problem with my specific environment.

Any insights about how I could proceed are most welcome, the fact that we can't inspect the blank window (unlike the macos reports) or see any console output leaves me kind of clueless at this point

@phenomen
Copy link

phenomen commented Mar 19, 2025

I have the same issue after some of the recent updates. Just a white screen and I can't even invoke DevTools (F12). I've tried using custom (old) additionalBrowserArgs as suggested here but it didn't help.

tauri info

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 134.0.3124.72
    ✔ MSVC:
        - Visual Studio Build Tools 2019
        - Visual Studio Build Tools 2022
    ✔ rustc: 1.85.1 (4eb161250 2025-03-15)
    ✔ cargo: 1.85.1 (d73d2caf9 2024-12-31)
    ✔ rustup: 1.28.1 (f9edccde0 2025-03-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 22.11.0
    - pnpm: 10.6.5
    - npm: 11.2.0
    - bun: 1.2.5

[-] Packages
    - tauri 🦀: 2.3.1
    - tauri-build 🦀: 2.0.6
    - wry 🦀: 0.50.5
    - tao 🦀: 0.32.8
    - @tauri-apps/api : 2.3.0
    - @tauri-apps/cli : 2.3.1

[-] Plugins
    - tauri-plugin-dialog 🦀: 2.2.0
    - @tauri-apps/plugin-dialog : 2.2.0
    - tauri-plugin-shell 🦀: 2.2.0
    - @tauri-apps/plugin-shell : 2.2.0
    - tauri-plugin-global-shortcut 🦀: 2.2.0
    - @tauri-apps/plugin-global-shortcut : 2.2.0
    - tauri-plugin-updater 🦀: 2.6.1
    - @tauri-apps/plugin-updater : 2.6.1
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

@BTMuli
Copy link

BTMuli commented Mar 20, 2025

In case it might help, I reproduced the issue on my machine with this minimal example (I tested this on another mac os machine where it works as expected)

tauri info output
I'm not sure whether this is exactly the same issue. I can create a new one if it seems relevant.

@EliottGaboreau Fortunately,just your code has some wrong.😓

tauri::WebviewWindowBuilder::new(
  &app_handle,
  "command_window",
  tauri::WebviewUrl::App("/".into()),
)
.inner_size(860.0,420.0)
.visible(true)
.title("Title")
.build()
.unwrap();

You neither define the size nor the visible, add these it works ok.

@huangmiuXyz
Copy link

It does not work when I lock my Wry version to 0.50.3. I'm using macOS

My problem is thatI only createda window but did not createa WebView.

@retorted
Copy link

retorted commented Mar 24, 2025

I've encountered similar "white screen" issues in development, and after some debugging I found it's related to the way the Vite dev server is compiling assets on-demand when the Webview first loads.

You can get a bit more visibility around this issue by setting "dev": "vite dev --debug transform" under "scripts": in package.json.

If compiling completes, the screen will load (after some time showing the "white screen") but if it hangs or throws a fatal error during compiling you might be stuck on the white screen, I'd suggest you need to debug your asset compilation in that case.

Hot tip: warming some of the assets can greatly reduce that load-time: Vite warming docs

[edit] Hot tip number 2: if you're using the sass package, try switching it out for sass-embedded, my total compile time decreased by around 85% when I did this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Windows status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

8 participants