Skip to content

Commit

Permalink
fix(localhost): adjust documentation to work on dev, closes tauri-app…
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored May 22, 2023
1 parent e2a54e9 commit 6adcedc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions plugins/localhost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6adcedc

Please sign in to comment.