new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Develop · all subjects

build & configuration

22 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Mobile preparation: recreate main.rs for desktop

Create a new `src-tauri/src/main.rs` file that calls the shared run function from lib.rs. The file should contain the attribute `#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]` followed by a main function that calls `app_lib::run()`.

Mobile preparation: modify Cargo.toml for shared library

To target mobile with an existing Tauri application, modify the Cargo manifest to produce a shared library. Add a `[lib]` block to `src-tauri/Cargo.toml` with the configuration: `name = "app_lib"` and `crate-type = ["staticlib", "cdylib", "rlib"]`.

Mobile preparation: rename main.rs to lib.rs and create mobile entry point

Rename `src-tauri/src/main.rs` to `src-tauri/src/lib.rs`. This file will be shared by both desktop and mobile targets. Replace the main function with a function decorated with `#[cfg_attr(mobile, tauri::mobile_entry_point)]` and named `pub fn run()`. The `tauri::mobile_entry_point` macro prepares the function to run on mobile.

Tauri v2 automated migration command

Tauri v2 includes a `migrate` command that automates migration from Tauri 1.0. Run `npm run tauri migrate`, `yarn tauri migrate`, `pnpm tauri migrate`, or `cargo tauri migrate` depending on your package manager.

Tauri v2: new Cargo feature

The new linux-protocol-body Cargo feature enables custom protocol request body parsing for IPC (inter-process communication). It requires webkit2gtk 2.40 or later.

Tauri v2: Env.args field removal

The Env.args field has been removed in Tauri v2. Use Env.args_os field instead.

Tauri v2: mobile entry point setup

For mobile support, rename the main function in lib.rs to run(), annotate with #[cfg_attr(mobile, tauri::mobile_entry_point)], and create a new main.rs that calls app_lib::run(). The tauri::mobile_entry_point macro prepares the function for execution on mobile platforms.

Tauri v2: mobile preparation library output

To prepare Tauri app for mobile, the project must output a shared library alongside desktop executable. Modify Cargo.toml to add [lib] section with name and crate-type set to ["staticlib", "cdylib", "rlib"]. Move main.rs content to lib.rs and wrap run function with #[cfg_attr(mobile, tauri::mobile_entry_point)] attribute.

Tauri 1.0 to 2.0 migration: automatic migrate command

Tauri v2 CLI includes a `migrate` command that automates most of the migration work from Tauri 1.0 to 2.0. The command can be run with npm, yarn, pnpm, or cargo. The migrate command is referenced in the CLI documentation.

Tauri 2.0 environment variable naming changes

Environment variable names used by Tauri CLI have been renamed for consistency: TAURI_PRIVATE_KEY → TAURI_SIGNING_PRIVATE_KEY; TAURI_KEY_PASSWORD → TAURI_SIGNING_PRIVATE_KEY_PASSWORD; TAURI_SKIP_DEVSERVER_CHECK → TAURI_CLI_NO_DEV_SERVER_WAIT; TAURI_DEV_SERVER_PORT → TAURI_CLI_PORT; TAURI_PATH_DEPTH → TAURI_CLI_CONFIG_DEPTH; TAURI_FIPS_COMPLIANT → TAURI_BUNDLER_WIX_FIPS_COMPLIANT; TAURI_DEV_WATCHER_IGNORE_FILE → TAURI_CLI_WATCHER_IGNORE_FILENAME; TAURI_TRAY → TAURI_LINUX_AYATANA_APPINDICATOR; TAURI_APPLE_DEVELOPMENT_TEAM → APPLE_DEVELOPMENT_TEAM; TAURI_PLATFORM → TAURI_ENV_PLATFORM; TAURI_ARCH → TAURI_ENV_ARCH; TAURI_FAMILY → TAURI_ENV_FAMILY; TAURI_PLATFORM_VERSION → TAURI_ENV_PLATFORM_VERSION; TAURI_PLATFORM_TYPE → TAURI_ENV_PLATFORM_TYPE; TAURI_DEBUG → TAURI_ENV_DEBUG.

Tauri v2: removed Cargo features

The following Cargo features have been removed in Tauri v2: reqwest-client (reqwest is now the only client); reqwest-native-tls-vendored (replaced by native-tls-vendored); process-command-api (use shell plugin instead); shell-open-api (use shell plugin instead); windows7-compat (moved to notification plugin); updater (now a plugin); linux-protocol-headers (webkit2gtk minimum version upgraded and enabled by default); system-tray (renamed to tray-icon).

Vite development server configuration example for Tauri v2.0

Example Vite configuration for Tauri 2.0 release candidate: const host = process.env.TAURI_DEV_HOST; export default defineConfig({ plugins: [svelte()], clearScreen: false, server: { host: host || false, port: 1420, strictPort: true, hmr: host ? { protocol: 'ws', host: host, port: 1430 } : undefined } }); This replaces the beta version's approach of using internalIpV4Sync() and checking TAURI_ENV_PLATFORM.

Tauri v2 migrate command for beta to release candidate upgrade

The Tauri v2 CLI includes a `migrate` command that automates most of the migration work from Tauri 2.0 beta to Tauri 2.0 release candidate. Run it with: npm run tauri migrate (npm), yarn tauri migrate (yarn), pnpm tauri migrate (pnpm), or cargo tauri migrate (cargo install).

Tauri mobile development server now uses TAURI_DEV_HOST environment variable

In Tauri v2.0, the built-in mobile development server no longer exposes to the entire network. Instead, use the TAURI_DEV_HOST environment variable to control the development server host configuration. The previous approach of checking TAURI_ENV_PLATFORM for 'android' or 'ios' is no longer recommended.

iOS development server configuration changed from TAURI_ENV_PLATFORM to TAURI_DEV_HOST

For iOS physical devices, the development server configuration must be updated. In Tauri 2.0 beta, developers checked if TAURI_ENV_PLATFORM matched 'android' or 'ios' and configured the Vite dev server accordingly. In Tauri 2.0, check the TAURI_DEV_HOST environment variable instead and set the server host to the TAURI_DEV_HOST value when it is set.

internal-ip npm package no longer needed in Tauri v2.0

The internal-ip npm package is no longer required for Tauri v2.0 development. Use the TAURI_DEV_HOST environment variable value directly instead.

tauri-egui plugin setup in Cargo.toml

Add tauri-egui to dependencies in Cargo.toml with version 0.1.

Enable tauri-egui plugin in Builder setup

In the tauri::Builder setup callback, enable the egui plugin by calling app.wry_plugin(tauri_egui::EguiPluginBuilder::new(app.handle())).

Update Tauri dependencies to 2.0.0-alpha.0

To update to Tauri 2.0.0-alpha.0, run npm install @tauri-apps/cli@next @tauri-apps/api@next (or equivalent with yarn or pnpm), and run cargo add tauri@2.0.0-alpha.0, cargo add tauri-build@2.0.0-alpha.0 --build, and cargo install tauri-cli --version "^2.0.0-alpha" --locked.

TLS support behind Cargo feature in Tauri 2.0.0-alpha.0

TLS support has been moved behind a Cargo feature in Tauri 2.0.0-alpha.0 until cross-compilation of OpenSSL on Windows is resolved.

Device execution not supported with Xcode 14

Running on a device is not supported when using Xcode 14 in Tauri 2.0.0-alpha.0.

Verso planned features: pre-built executable and evergreen runtime

Future work includes releasing a pre-built Verso executable for easier setup. A long-term goal is an evergreen shared Verso similar to WebView2 on Windows that updates automatically and is shared between multiple apps, reducing bundle size by not requiring the browser to be shipped inside each app.

Give your agent this brain