Skip to content

tauri dev is incredibly slow #8920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KiARC opened this issue Feb 20, 2024 · 7 comments
Closed

tauri dev is incredibly slow #8920

KiARC opened this issue Feb 20, 2024 · 7 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@KiARC
Copy link

KiARC commented Feb 20, 2024

Describe the bug

When running tauri dev the app takes minutes to launch, and a single change to a file forces it to start over, seemingly from scratch. This happens when running yarn tauri dev in the unchanged result of yarn create tauri-app. Around 300 rust libraries seem to be getting compiled every time a change is made.

Reproduction

yarn create tauri-app # Fill out the form and let it create the project
cd <app-directory>
yarn
yarn tauri dev

Expected behavior

Interface loads quickly and refreshes quickly when files are changed.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 121.0.2277.128
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.74.1 (a28077b28 2023-12-04)
    ✔ cargo: 1.74.1 (ecb9851af 2023-10-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 21.6.1
    - pnpm: 8.15.3
    - yarn: 1.22.19
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 1.6.0
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.7
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.10

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

@KiARC KiARC added status: needs triage This issue needs to triage, applied to new issues type: bug labels Feb 20, 2024
@KiARC
Copy link
Author

KiARC commented Feb 20, 2024

Huh, if the change is made to the UI the interface reloads instantly. It's only backend changes that take so long. That makes a bit more sense but is still problematic.

@KiARC
Copy link
Author

KiARC commented Feb 20, 2024

Running tauri build and then tauri dev seems to have fixed the issue. I'm guessing the dev command does something differently that causes it to rebuild everything every single time. Regardless, I hope that this can be documented somewhere and/or fixed.

@amrbashir
Copy link
Member

This is something related to Rust and its incremental compilation, it shouldn't recompile your dependencies unless necessary. Anyways, there is nothing we can do since this seems like a Rust issue.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2024
@kon72
Copy link

kon72 commented Jul 19, 2024

If you are using rust-analyzer on VS Code, try using separate target directory for rust-analyzer and tauri.

.vscode/settings.json:

{
  "rust-analyzer.server.extraEnv": {
    "CARGO_TARGET_DIR": "${workspaceFolder}/src-tauri/target/analyzer"
  },
  "rust-analyzer.cargo.targetDir": "${workspaceFolder}/src-tauri/target/analyzer"
}

ref: rust-lang/rust-analyzer#4616

@KiARC KiARC changed the title tauri dev is comically slow tauri dev is incredibly slow Jul 19, 2024
@rxliuli
Copy link

rxliuli commented Apr 29, 2025

I encountered the same problem. On the M2 Max, every time I modify the Rust code, it blocks and compiles for more than 30 seconds. I don't know why the created template project has issues, but obviously, this is problematic.

Kapture.2025-04-25.at.15.42.38.mp4

@FabianLars
Copy link
Member

@rxliuli yours sounds more like this #11577 (has a workaround inside)

@rxliuli
Copy link

rxliuli commented Apr 29, 2025

@rxliuli yours sounds more like this #11577 (has a workaround inside)

Yes, I know this temporary workaround. But I don't understand why it wasn't done correctly in the template project directly, and instead you have to manually modify the configuration to fix such an obvious problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

5 participants