As the title says. Get the weird thing that when I build my app it shows nothing/tauri.localhost refused to connect(see screenshot). The most right one is with cargo tauri dev. Followed this for base for an tauri + sveltekit application: https://tauri.app/v1/guides/getting-started/setup/sveltekit/ I use JS and my distDir is ../build.
Dont really know whats causing this.
Ty in advance :)
#AssetNotFound("index.html") only on cargo tauri build. cargo tauri dev works fine.
18 messages · Page 1 of 1 (latest)
In case you still face this issue please post the output of cargo tauri info and your sveltekit config for a start
Will do. Omw back from work might take an hour or so
cargo tauri info
Environment
› OS: Windows 10.0.22621 X64
› Webview2: 115.0.1901.183
› MSVC:
- Visual Studio Community 2022
- Visual Studio Build Tools 2019
› Node.js: 18.10.0
› npm: 8.19.2
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.25.2
› rustc: 1.68.2
› cargo: 1.68.2
› Rust toolchain: stable-x86_64-pc-windows-msvc
Packages
› @tauri-apps/cli [NPM]: 1.2.3 (outdated, latest: 1.4.0)
› @tauri-apps/api [NPM]: 1.4.0
› tauri [RUST]: 1.4.1,
› tauri-build [RUST]: 1.4.0,
› tao [RUST]: 0.16.2,
› wry [RUST]: 0.24.3,
App
› build-type: bundle
› CSP: unset
› distDir: ../build
› devPath: http://localhost:5173/
› framework: Svelte
› bundler: Vite
App directory structure
├─ .svelte-kit
├─ build
├─ log-cleaner-rs
├─ node_modules
├─ src
├─ src-tauri
└─ static
The log cleaner-rs is another project, doesnt get built with it but its exe is needed and part of external bins
svelte.config.js
import adapter from '@sveltejs/adapter-auto';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
}
};
export default config;
Looks like you missed this part: https://tauri.app/v1/guides/getting-started/setup/sveltekit/#sveltekit-in-ssg-mode
It's not optional since tauri does not include a nodejs runtime
Hey @slow burrow Thanks for the response. Will take a look, tbh thought ssg might be "optional" but mb I guess. Since you say its not optimal, what might be a better option?
Since you say its not optimal, what might be a better option?
I said it's not optional (=it's required), not optimal. SSR just doesn't work in tauri so you have to put sveltekit into spa or ssg mode (or a mix of both). Which tbh is enough of a reason for me to not use sveltekit at all since i don't like file based routers anyway.
Oh lol misread mb
I have chosen sveltekit since I want a multipage application without the hassle of react or vue (using vue at work, personally I think its a pain). And I really liked svelte from its imo simpilicity
just because i rule out sveltekit doesn't mean i'd rule out svelte itself too. I'd just use vite+svelte with a code-centric router. But i'm also aware that this is a bit frowned upon ever since sveltekit was hyped up...
@slow burrow First of all thanks for all the help. Love you bro. Tbh as I said I work with Vue at work and dont have much knowledge about svelte was fun when I first tried out tho. Didnt want to implement my own router, so went with SvelteKit. Maybe when I have finished the project sveltekit I might see about that. For now again thanks. God bless you ❤️
(This means its fixed)
how do u find this info?
What info? The sveltekit config? There should be a svelte.config.js/ts file next to package.json i think
the "cargo tauri info"
I am facing a similar issue in reactjs 😦
may not be cargo, but npm run tauri info or yarn tauri info or whatever else you use to do tauri dev