Repository: tauri
Issue: [bug] Build fails if front-end files are collectively too large.
Labels: type: bug,status: needs triage

### Describe the bug

I have been running into an issue where my tauri app will not build if my front-end assets amount to around 1 GB or more of data. If I delete enough assets the project builds. The project I have been testing with is the basic "Getting Started" project using JavaScript, npm, and Vanilla presets. The only thing I've changed is the front-end. Below is a rough tree of my project and it's file sizes.

src
|
|_index.html(82 KB)
|_[14 other html files](979 KB)
|
|_assets
  |
  |_fonts(308 KB)
  |_gallery(148 MB)
  |_images(27 MB)
  |_libraries(928 KB)
  |_app(337 MB)
  |_obj(684 MB)
  |_videos(298 MB)

If I delete both the app and video folders, the project builds. Alternatively I can leave those folders and delete the obj folder which will also allow me to build.

If I attempt to build without removing assets I receive errors stating that random metafiles are corrupt. Depending on what I delete the metafile that corrupts changes but stays consistent. 

I am attempting to use Tauri in place of a current Electron solution, and due to limitations of this project all assets must be bundled with the project.

### Reproduction

My guess would be to reproduce this you need to make a tauri app based of the quick start project and fill it's front-end with more than a gigabyte of assets.

### Expected behavior

Expected a build of my app to be packaged.

### Full `tauri info` output

```text
[✔] Environment

    - OS: Windows 10.0.19045 x86_64 (X64)

    ✔ WebView2: 131.0.2903.112

    ✔ MSVC: Visual Studio Professional 2022

    ✔ rustc: 1.84.0 (9fc6b4312 2025-01-07)

    ✔ cargo: 1.84.0 (66221abde 2024-11-19)

    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)

    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)

    - node: 20.18.0

    - npm: 10.8.2

 

[-] Packages

    - tauri 🦀: 2.2.2

    - tauri-build 🦀: 2.0.5

    - wry 🦀: 0.48.1

    - tao 🦀: 0.31.1

    - @tauri-apps/api : not installed!

    - @tauri-apps/cli : 2.2.4

 

[-] Plugins

    - tauri-plugin-opener 🦀: 2.2.4

    - @tauri-apps/plugin-opener : not installed!

 

[-] App

    - build-type: bundle

    - CSP: unset

    - frontendDist: ../src
```


### Stack trace

```text
PS C:\{USER_DIR}\Documents\TauriTests\Test1\test-app> npm run tauri build

 

> test-app@0.1.0 tauri

> tauri build

   Compiling test-app v0.1.0 (C:\{USER_DIR}\Documents\TauriTests\Test1\test-app\src-tauri)

error[E0786]: found invalid metadata files for crate `test_app_lib`

--> src\main.rs:5:5

  |

5 |     test_app_lib::run()

  |     ^^^^^^^^^^^^

  |

  = note: corrupt metadata encountered in \\?\C:\ {USER_DIR}\Documents\TauriTests\Test1\test-app\src-tauri\targ

 

For more information about this error, try `rustc --explain E0786`.

error: could not compile `test-app` (bin "test-app") due to 1 previous error

failed to build app: failed to build app

    Error failed to build app: failed to build app
```


### Additional context

Some experiments I've tried is creating a base getting started app and only adding my asset files, this also caused the build to fail.