Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 39 ยท Getting Started

The Dev Loop and Building a Release

Learn how tauri dev and tauri build work, how hot reload and rebuilds behave, how to debug the webview and the Rust core, and what a release build produces.

Two commands cover most of your daily work: tauri dev while you build, and tauri build when you ship. Understanding what they do behind the scenes makes problems easy to locate, because a Tauri app has two build systems (the frontend's and cargo) that must cooperate.

tauri dev

Terminal
npm run tauri dev

The tauri script in package.json just runs the Tauri CLI. In dev mode the CLI does this, in order:

  1. Runs the command from build.beforeDevCommand in tauri.conf.json, usually npm run dev, which starts your frontend dev server (Vite, for instance) on a port.
  2. Waits until build.devUrl answers.
  3. Compiles the Rust crate in debug mode with cargo.
  4. Starts the app and points its webview at devUrl.
  5. Watches Rust files. When you save one, it recompiles and restarts the app.
sequenceDiagram
  participant CLI as tauri CLI
  participant FE as Frontend dev server
  participant Cargo as cargo
  participant App as App window
  CLI->>FE: beforeDevCommand (npm run dev)
  CLI->>FE: wait for devUrl
  CLI->>Cargo: build (debug)
  Cargo-->>CLI: binary
  CLI->>App: start, load devUrl
  Note over FE,App: frontend edits hot-reload
  Note over Cargo,App: Rust edits rebuild and restart

Two reload paths: the frontend reloads in place, Rust restarts the whole process.

Because the frontend edits are served by the dev server, they appear instantly (hot module replacement, if your tool supports it). Rust edits take longer because the app has to be rebuilt, but only the changed crate recompiles.

Opening devtools

In debug builds you can right-click the page and choose Inspect, or press the usual devtools shortcut (F12 or Ctrl/Cmd+Shift+I on most platforms). It opens the engine's own inspector: the Elements, Console and Network panels you know. You can also open it from Rust with window.open_devtools() in debug builds.

Debugging Rust

Messages printed with println! or eprintln! appear in the terminal where you ran tauri dev. For real breakpoints, launch the app from your IDE's debugger (VS Code with rust-analyzer and CodeLLDB or the Windows debugger, or RustRover). Panics print a message and a location; set RUST_BACKTRACE=1 for a full stack trace.

Terminal
# macOS / Linux
RUST_BACKTRACE=1 npm run tauri dev
POWERSHELL
# Windows PowerShell
$env:RUST_BACKTRACE = "1"; npm run tauri dev

tauri build

Terminal
npm run tauri build

The release build:

  1. Runs build.beforeBuildCommand (typically npm run build) so your frontend becomes static files in build.frontendDist.
  2. Compiles Rust in release mode (optimized, slow to compile, small and fast to run).
  3. Embeds the frontend files into the binary.
  4. Bundles installers for your current operating system.

Typical outputs land under src-tauri/target/release/bundle/: an .msi and an NSIS .exe installer on Windows, a .app and .dmg on macOS, .deb, .rpm and .AppImage on Linux. You build for a platform on that platform; cross-compiling desktop installers is not the normal path, so teams use a CI matrix. Packaging is the subject of its own chapter later in this tutorial.

To build only a single format, pass --bundles, for example npm run tauri build -- --bundles nsis on Windows. To skip bundling and only produce the executable, use --no-bundle.

Debug versus release

tauri dev (debug) tauri build (release)
Rust optimization Off, fast to compile On, slow to compile
Frontend source Dev server URL Embedded static files
Devtools Available Off unless you enable a feature
Overflow checks Panic on integer overflow Wrap silently
Speed of the app Noticeably slower Fast

Never judge performance from a debug build. Measure a release build.

Try it: simulate the dev loop (stand-in)

This stand-in models the "which reload path applies?" decision: frontend files trigger hot reload, Rust files trigger a rebuild, config files need a restart.

Node.js Stand-in: what happens when I save this file?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Try it: why release builds are better to measure (stand-in)

A debug build does extra checks. This stand-in imitates the effect by running the same loop with and without a "checked" mode. The absolute times vary per machine; only the relative difference is the lesson.

Node.js Stand-in: checks have a cost

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Useful flags and habits

  • npm run tauri dev -- --release runs the dev flow with an optimized build, handy for profiling.
  • npm run tauri build -- --debug creates installers from a debug build, helpful to reproduce an installer-only bug with devtools on.
  • Keep the terminal visible: Rust compile errors are long but precise, and the first error is usually the cause of the rest.
  • Commit Cargo.lock for applications so everyone builds the same dependency versions.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does build.devUrl in tauri.conf.json point to?

    In tauri dev the window loads your dev server, so frontend edits hot-reload.
  2. 2. What happens when you save a Rust file during tauri dev?

    Rust changes need a cargo rebuild and a process restart.
  3. 3. Why should you not measure performance with tauri dev?

    Debug builds skip optimizations and add checks, so they are much slower than release builds.
  4. 4. Where do you usually find installers after tauri build?

    Bundles are written under the cargo target folder in release/bundle, grouped by format.

Summary

  • tauri dev runs the frontend dev server, builds Rust in debug mode and reloads on change.
  • Frontend edits hot-reload; Rust edits rebuild and restart; config edits need a restart.
  • tauri build creates static frontend files, an optimized binary and installers for the current OS.
  • Debug in devtools for the frontend, terminal logs and a debugger for Rust.
  • Always measure performance in a release build.

Next: Core and webview architecture