From 91248f3a79543576357f41721a9b5216e5f4f461 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 22 May 2023 16:01:33 -0300 Subject: [PATCH] fix(localhost): adjust documentation to work on dev, closes #388 --- plugins/localhost/README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/localhost/README.md b/plugins/localhost/README.md index 3fd7797a..410f8deb 100644 --- a/plugins/localhost/README.md +++ b/plugins/localhost/README.md @@ -41,14 +41,21 @@ fn main() { let window_url = WindowUrl::External(url); // rewrite the config so the IPC is enabled on this URL context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone()); - context.config_mut().build.dev_path = AppUrl::Url(window_url.clone()); tauri::Builder::default() .plugin(tauri_plugin_localhost::Builder::new(port).build()) .setup(move |app| { - WindowBuilder::new(app, "main".to_string(), window_url) - .title("Localhost Example") - .build()?; + WindowBuilder::new( + app, + "main".to_string(), + if cfg!(dev) { + Default::default() + } else { + window_url + } + ) + .title("Localhost Example") + .build()?; Ok(()) }) .run(context)