add tauri

This commit is contained in:
polv committed 2026-01-25 11:53:34 +07:00
1 parent 9fd12d3e74
commit f5b0903069
27 files changed
+5214 -1

No files matched your search

+37 -1
View File
@@ -1,6 +1,8 @@
import { defineConfig } from 'vitepress'
import nodePolyfills from 'rollup-plugin-polyfill-node';
const TAURI_HOST = ''
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "yt2press",
@@ -27,6 +29,40 @@ export default defineConfig({
]
},
vite: {
plugins: [nodePolyfills({ include: ['fs'] })]
plugins: [nodePolyfills({ include: ['fs'] })],
clearScreen: false,
server: {
// make sure this port matches the devUrl port in tauri.conf.json file
port: 5173,
// Tauri expects a fixed port, fail if that port is not available
strictPort: true,
// if the host Tauri is expecting is set, use it
host: TAURI_HOST || false,
hmr: TAURI_HOST
? {
protocol: 'ws',
host: TAURI_HOST,
port: 1421,
}
: undefined,
watch: {
// tell vite to ignore watching `src-tauri`
ignored: ['**/src-tauri/**'],
},
},
// Env variables starting with the item of `envPrefix` will be exposed in tauri's source code through `import.meta.env`.
envPrefix: ['VITE_', 'TAURI_ENV_*'],
build: {
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
target:
process.env.TAURI_ENV_PLATFORM == 'windows'
? 'chrome105'
: 'safari13',
// don't minify for debug builds
minify: !process.env.TAURI_ENV_DEBUG ? 'esbuild' : false,
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_ENV_DEBUG,
},
}
})