tauri-apps/tauri · error

The configured frontendDist includes the `{:?}` {}. Please i

Error message

The configured frontendDist includes the `{:?}` {}. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.

What it means

The CLI scans the canonicalized `frontendDist` for cargo `target/` output (issue #13287) and for `node_modules` and `src-tauri` subdirectories. If any are found, it aborts because bundling would embed hundreds of megabytes of dependencies or your whole Rust project into the app binary.

Source

Thrown at crates/tauri-cli/src/build.rs:256

    let mut out_folders = Vec::new();
    if let Ok(web_asset_canonical) = dunce::canonicalize(web_asset_path) {
      if let Ok(relative_path) = target_path.strip_prefix(&web_asset_canonical) {
        let relative_str = relative_path.to_string_lossy();
        if !relative_str.is_empty() {
          out_folders.push(relative_str.to_string());
        }
      }

      for folder in &["node_modules", "src-tauri"] {
        let sub_path = web_asset_canonical.join(folder);
        if sub_path.is_dir() {
          out_folders.push(folder.to_string());
        }
      }
    }

    if !out_folders.is_empty() {
      crate::error::bail!(
        "The configured frontendDist includes the `{:?}` {}. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.",
        out_folders,
        if out_folders.len() == 1 { "folder" } else { "folders" }
      );
    }
  }

  if options.runner.is_none() {
    options.runner = config.build.runner.clone();
  }

  options
    .features
    .extend_from_slice(config.build.features.as_deref().unwrap_or_default());
  interface.build_options(&mut options.args, &mut options.features, mobile);

  Ok(())
}

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Configure your frontend bundler to emit into a dedicated output dir (e.g. vite `build.outDir: 'dist'`) and point `frontendDist` there
  2. If you use a custom cargo target dir, move it outside `frontendDist`
  3. Remove stray `node_modules`/`src-tauri` folders accidentally created inside the dist folder, then rebuild

Example fix

// before (tauri.conf.json + vite.config)
"frontendDist": "../"           // project root contains node_modules & src-tauri

// after (vite.config.ts: build.outDir = 'dist')
"frontendDist": "../dist"
Defensive patterns

Strategy: validation

Validate before calling

# abort if frontendDist swallows node_modules, src-tauri, or a target dir
DIST=$(jq -r '.build.frontendDist' src-tauri/tauri.conf.json)
ROOT="src-tauri/$DIST"
for bad in node_modules src-tauri target; do
  [ -e "$ROOT/$bad" ] && { echo "frontendDist contains $bad" >&2; exit 1; }
done

Prevention

When it happens

Trigger: Setting `frontendDist` to the project root (`"../"`) so it swallows `node_modules/` and `src-tauri/`; a frontend bundler configured to emit into the repo root; a cargo target directory placed inside the frontend output folder.

Common situations: Trying to serve the repo root to avoid configuring a bundler outDir; vite/webpack `outDir` left at default while `frontendDist` points at a parent; `CARGO_TARGET_DIR` set to a path under `dist/`.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/e96bb801374d894a. Report an issue: GitHub.