Integrate Vite and Tauri
English | 简体中文
$ npm install vite-plugin-tauri-plus -D
after init src-tauri
, add vite-plugin-tauri-plus
into vite.config.ts
.
import { defineConfig } from 'vite'
import tauri from 'vite-plugin-tauri-plus'
export default defineConfig({
plugins: [tauri()],
})
Inject options into tauri cli
example
import { defineConfig } from 'vite'
import tauri from 'vite-plugin-tauri-plus'
export default defineConfig({
plugins: [
tauri({
bundles: ['deb', 'app', 'dmg'],
debug: true,
exitOnPanic: true,
release: true,
runner: 'cargo',
})
],
})
-
type: string[]
-
options: 'deb' | 'appimage' | 'msi' | 'app' | 'dmg' | 'updater'
-
description:
list of bundles to package. Each bundle must be one of
deb
,appimage
,msi
,app
ordmg
on MacOS andupdater
on all platforms. Note that theupdater
bundle is not automatically added so you must specify it if the updater is enabled.
-
type: string
-
description:
JSON string or path to JSON file to merge with tauri.conf.json
-
type: boolean
-
description:
Builds with the debug flag
-
type: boolean
-
description:
Exit on panic
-
type: boolean
-
description:
Run the code in release mode
-
type: boolean
-
description:
Enables verbose logging
-
type: string[]
-
description:
List of cargo features to activate
-
type: string
-
description:
Target triple to build against.It must be one of the values outputted by
$rustc --print target-list
oruniversal-apple-darwin
for an universal macOS application. Note that compiling an universal macOS application requires bothaarch64-apple-darwin
andx86_64-apple-darwin
targets to be installed.
-
type: string
-
description:
Binary to use to build the application, defaults to
cargo