Since Tauri is a toolkit for building applications there can be many files to configure project settings. Some common files that you may run across are
Cargo.toml. We briefly explain each on this page to help point you in the right direction for which file to modify.
The file can be either
Tauri.toml. The default is
tauri.conf.json. See the note below for more information.
This is the file used by the Tauri process. You can define build settings (such as the command run before
tauri build or
tauri dev), set the name, version of your app, [control the Tauri process][/references/v2/config#configuration-structure], and configure any plugin settings. You can find all of the options in the
tauri.conf.json API reference.
Cargo’s manifest file is used to declare Rust crates your app depends on, metadata about your app, and other Rust-related features. If you do not intend to do backend development using Rust for your app then you may not be modifying it much, but it’s important to know that it exists and what it does.
Below is an example of a barebones
Cargo.toml file for a Tauri project:
The most important parts to take note of are the
tauri dependencies. Generally, they must both be on the latest minor versions as the Tauri CLI, but this is not strictly required. If you encounter issues while trying to run your app you should check that any Tauri versions (
tauri-cli) are on the latest versions for their respective minor releases.
Cargo version numbers use Semantic Versioning. Running
cargo update will pull the latest available Semver-compatible versions of all dependencies. For example, if you specify
1.0.0 as the version for
tauri-build, Cargo will detect and download version
1.0.4 because it is the latest Semver-compatible version available. Tauri will update the major version number whenever a breaking change is introduced, meaning you should always be capable of safely upgrading to the latest minor and patch versions without fear of your code breaking.
If you want to use a specific crate version you can use exact versions instead by prepending
= to the version number of the dependency:
An additional thing to take note of is the
features= portion of the
tauri dependency. Running
tauri dev and
tauri build will automatically manage which features need to be enabled in your project based on the
"allowlist" properties you set in
When you build your application a
Cargo.lock file is produced. This file is used primarily for ensuring that the same dependencies are used across machines during development (similar to
package-lock.json in Node.js). Since you are developing a Tauri app, this file should be committed to your source repository (only Rust libraries should omit committing this file).
To learn more about
Cargo.toml you can read more in the official documentation.
This is the package file used by Node.js. If the frontend of a Tauri app is developed using Node.js-based technologies (such as
pnpm) this file is used to configure the frontend dependencies and scripts.
An example of a barebones
package.json file for a Tauri project might look a little something like this:
It’s common to use the
"scripts" section to store the command used to launch the frontend used by your Tauri application. The above file specifies the
dev command that you can run using
yarn dev or
npm run dev to start the frontend framework.
The dependencies object specifies which dependencies Node.js should download when you run either
npm install (in this case the Tauri CLI and API).
In addition to the
package.json file you may see either a
yarn.lock file or a
package-lock.json file. These files assist in ensuring that when you download the dependencies later you’ll get the exact same versions that you have used during development (similar to
Cargo.lock in Rust).
To learn more about
package.json you can read more in the official documentation.
© 2024 Tauri Contributors. CC-BY / MIT