mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-18 14:59:42 +02:00
Upgrade to Tauri 2.0 (#23)
This commit is contained in:
@@ -1,34 +1,29 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { internalIpV4 } from 'internal-ip';
|
||||
import svgr from 'vite-plugin-svgr';
|
||||
import topLevelAwait from 'vite-plugin-top-level-await';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
const config = defineConfig({
|
||||
plugins: [svgr(), react({}), topLevelAwait()],
|
||||
const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM);
|
||||
|
||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||
// prevent vite from obscuring rust errors
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(async () => ({
|
||||
plugins: [svgr(), react(), topLevelAwait()],
|
||||
clearScreen: false,
|
||||
// tauri expects a fixed port, fail if that port is not available
|
||||
server: {
|
||||
port: 1420,
|
||||
strictPort: true,
|
||||
host: mobile ? '0.0.0.0' : false,
|
||||
hmr: mobile
|
||||
? {
|
||||
protocol: 'ws',
|
||||
host: await internalIpV4(),
|
||||
port: 1421,
|
||||
}
|
||||
: undefined,
|
||||
watch: {
|
||||
ignored: ['**/src-tauri/**', '**/designs/**', '**/plugins/**'],
|
||||
},
|
||||
},
|
||||
|
||||
// to make use of `TAURI_DEBUG` and other env variables
|
||||
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
|
||||
envPrefix: ['VITE_', 'TAURI_'],
|
||||
build: {
|
||||
// Tauri supports es2021
|
||||
target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13',
|
||||
// don't minify for debug builds
|
||||
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
|
||||
// produce sourcemaps for debug builds
|
||||
sourcemap: !!process.env.TAURI_DEBUG,
|
||||
// Who cares
|
||||
chunkSizeWarningLimit: Infinity,
|
||||
},
|
||||
});
|
||||
|
||||
export default config;
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user