tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.57k stars 2.36k forks source link

[bug] SvelteKit got upgraded - Tauri not working with SvelteKit@2.0.0 (V2) #8592

Open nemzyx opened 5 months ago

nemzyx commented 5 months ago

Describe the bug

After carefully following the quickstart guide for SvelteKit, my Tauri application showed up blank (white/blank UI, but working on localhost:localhost:5173).

I noticed that recently SvelteKit got upgraded to version 2.

Workaround

So i tried using older packages, which is a workaround for now: npm create svelte@5.3.4 my-app npm install --save-dev @sveltejs/adapter-static@2.0.3

Reproduction

Follow instructions on https://tauri.app/v1/guides/getting-started/setup/sveltekit

Expected behavior

Welcome to SvelteKit

Visit kit.svelte.dev to read the documentation


... Showing up in window - but it doesn't.

:(

Full tauri info output

> tauri info

[✔] Environment
    - OS: Mac OS 10.15.7 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 21.5.0
    - pnpm: 8.6.9
    - npm: 10.2.5

[-] Packages
    - tauri [RUST]: 1.5.4
    - tauri-build [RUST]: 1.5.1    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.5
    - @tauri-apps/api : not installed!    - @tauri-apps/cli [NPM]: 1.5.9

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../build
    - devPath: http://localhost:5173/
    - framework: Svelte
    - bundler: Vite


### Stack trace

_No response_

### Additional context

[The migration to V2](https://kit.svelte.dev/docs/migrating-to-sveltekit-2#vitepreprocess-is-no-longer-exported-from-sveltejs-kit-vite) doesn't seem to be that bad, but this is my first time using Tauri so i'm not even exactly sure how the tech works or where i would begin to debug.
FabianLars commented 5 months ago

Hmm, i assume the issue is because they may have upgraded the minimal browser versions (for dev mode at least). The webview in macOS 10.15 is basically Safari 13. I don't have access to my 10.15 vm right now so this is only a guess. (it still works for me on the latest macos/windows versions fwiw)

Are there any errors in the devtools console of the webview?

cristianvogel commented 5 months ago

I just went through it, and after a couple of tries, got the expected result following the exact instructions. The first two tries gave me Os Error Code 2 - not sure if this was because I selected 'Try Svelte 5 preview (unstable)'

cristianvogel commented 5 months ago

Ah. Now I am running into

> tauri-svelte@0.0.1 tauri
> tauri dev

       Error failed to get cargo metadata: No such file or directory (os error 2)