[bug] Platform-Specific Configuration seems broken
Describe the bug
Platform-Specific Configuration seems broken.
"pnpm tauri android dev" do not load "tauri.android.conf.json" ( broken ) "pnpm tauri android build" do not load "tauri.android.conf.json" ( broken ) "pnpm tauri android build -c tauri.android.conf.json" do not load "tauri.android.conf.json" ( broken ) "pnpm tauri android dev -c tauri.android.conf.json" do load "tauri.android.conf.json" ( works )
also
"pnpm tauri build" on macos do not load "tauri.macos.conf.json" ( broken ) "pnpm tauri build -c tauri.macos.conf.json" on macos do not load "tauri.macos.conf.json" ( broken ) "pnpm tauri dev" on macos do load "tauri.macos.conf.json" ( works )
Reproduction
Try "pnpm tauri android dev" to see it not load "tauri.android.conf.json" Try "pnpm tauri android build" to see it not load "tauri.android.conf.json" Try "pnpm tauri android build -c tauri.android.conf.json" to see it not load "tauri.android.conf.json" Try "pnpm tauri build" on a mac to see it not load "tauri.macos.conf.json" Try "pnpm tauri build -c tauri.macos.conf.json" to see it not load "tauri.macos.conf.json"
Expected behavior
If "tauri.macos.conf.json" or "tauri.android.conf.json" exist during build or dev - they should be used.
If I use -c or -config to specify use of "tauri.whatever.conf.json" - it should be used.
Full tauri info output
[✔] Environment
- OS: Mac OS 14.4.1 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
✔ cargo: 1.77.2 (e52e36006 2024-03-26)
✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 21.7.1
- pnpm: 8.15.5
- npm: 10.5.1
[-] Packages
- tauri [RUST]: 2.0.0-beta.16
- tauri-build [RUST]: 2.0.0-beta.13
- wry [RUST]: 0.39.0
- tao [RUST]: 0.27.0
- tauri-cli [RUST]: 1.5.11
- @tauri-apps/api [NPM]: 2.0.0-beta.7
- @tauri-apps/cli [NPM]: 2.0.0-beta.12
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: SolidJS
- bundler: Vite
Stack trace
No response
Additional context
No response
Works fine on my Windows machine, can you please update your tauri dependencies and also the cli? if still doesn't work please provide a minimal reproduction repo.
Updated and re-tested... ..unfortunately issues persist.
For some reason Rust only allowed me to do Beta 13 when building ( see new tauri info above )
Added reproduction of the 5 issues I found - let me know if I need to add anything else ( pls bear with me - new at this )
@amrbashir My apologies - seems I was mistaken ! - conf files loads... ..it's the "URL" that only works in dev...not in build:
See windows section below - "url": "/indexDesktop.html"
When I do "pnpm tauri dev" it loads indexDesktop.html When I do "pnpm tauri build" it loads index.html
See below my "tauri.macos.conf.json" file:
{ "productName": "tauri-mobile-neo", "version": "0.0.0", "identifier": "com.oddmade.dev", "build": { "beforeDevCommand": "pnpm dev", "devUrl": "http://localhost:1420", "beforeBuildCommand": "pnpm build", "frontendDist": "../dist" }, "app": {"windows": [ { "title": "tauri-desktop", "width": 1200, "height": 800, "url": "/indexDesktop.html" } ], "security": { "csp": null } }, "bundle": { "active": true, "targets": "all", "icon": [ "icons/32x32.png", "icons/128x128.png", "icons/[email protected]", "icons/icon.icns", "icons/icon.ico" ] } }
@amrbashir Also - it seems when I do "pnpm tauri android dev" it loads "tauri.macos.conf.json" instead of "tauri.android.conf.json"
If I force it with "pnpm tauri android dev -c tauri.android.conf.json" it loads "tauri.android.conf.json"
..but again - when I do "pnpm tauri android build" or "pnpm tauri build" it always loads index.html and ignores the "url" i set in the "tauri.android.conf.json" or "tauri.macos.conf.json"... ..even when I force it with -c
Am I doing something wrong here - or is it a bug ?
If I force it with "pnpm tauri android dev -c tauri.android.conf.json" it loads "tauri.android.conf.json"
Hmm, we had that problem once before already but it was fixed in https://github.com/tauri-apps/tauri/pull/7802. Maybe we broke it again 🤔
..but again - when I do "pnpm tauri android build" or "pnpm tauri build" it always loads index.html and ignores the "url" i set in the "tauri.android.conf.json" or "tauri.macos.conf.json"... ..even when I force it with -c
As far as i know the whole window config is ignored on mobile (since it doesn't have the concept of a window) so it will always use devUrl and frontendDist respectively.
@FabianLars Perhaps this is me doing it the wrong way...
I'm trying to get "tauri.android.conf.json" to load indexMobile.html - and "tauri.macos.conf.json" to load indexDesktop.html
..so each platform can have different index.html files.
..but it seems macos only allow me to change the window URL in dev mode... ( not build )
..and android ( that ignores the window section ) don't seem to allow a customised index.html at all ?
( after further checks, conf files seems to load fine - it's the url that I don't get to work - so sorry for the confusion )
I guess we could add a new config option app > defaultUrl that controls which urls is loaded onto the webview when it is not specified on url of the window config or when creating the webview on mobile.
@amrbashir That would be very useful... I'm writing an app that is very similar in core function on desktop vs mobile - but the UX / UI needs to be different due to screen size and use cases - hence the need for a custom index.html per platform.
This looks like a bug after all, so no need for app > defaultUrl once this bug is fixed