Open preyneyv opened 10 months ago
Not an "automatic" solution but you could use the --config
flag to specify a merge config to overwrite values that differ between the configs.
Alternatively you could change the bundle id in your code with something like this (i'd choose the first option though)
fn main() {
let mut context = tauri::generate_context!();
context.config_mut().tauri.bundle.identifier = "a.b.c".to_string();
tauri::Builder::default()
.context(context) // make sure to re-use the same context
.run("error running tauri app");
}
I think option 1 covers this usecase good enough but i'll leave the issue open for the others to make a decision.
Thank you! The --config
flag works perfectly for me, I can pass it in during my build process.
Describe the problem
I'd like to change the bundle identifier based on a build-time configuration (for instance,
debug_assertions
or an environment variable) to enable plugins liketauri-plugin-single-instance
and app configuration stored in%LocalAppData%
to distinguish between release and debug builds.Describe the solution you'd like
A general solution would be loading a modified
tauri.conf.json
based on the build type, similar to how Tauri currently loadstauri.<platform>.conf.json
depending on the platform.For instance, there could be a
tauri.conf.dev.json
that's loaded for dev builds that overwrites the bundle identifier. This is also a pretty common pattern forwebpack.config.js
so it's not an entirely new pattern, at least for web developers.Alternatives considered
To resolve the app configuration issue, I'm currently using a function like this:
but I don't have a good solution for other places the bundle identifier would be used.
Additional context
No response