2022-12-27 20:32:29 +03:00
|
|
|
import { defineConfig } from "vite";
|
|
|
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
2023-11-08 04:56:21 +03:00
|
|
|
import { internalIpV4Sync } from 'internal-ip'
|
|
|
|
|
|
|
|
const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM);
|
2022-12-27 20:32:29 +03:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [svelte()],
|
|
|
|
|
|
|
|
// Vite optons tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
|
|
|
// prevent vite from obscuring rust errors
|
|
|
|
clearScreen: false,
|
|
|
|
// tauri expects a fixed port, fail if that port is not available
|
|
|
|
server: {
|
2023-11-08 04:56:21 +03:00
|
|
|
host: mobile ? "0.0.0.0" : false,
|
2022-12-27 20:32:29 +03:00
|
|
|
port: 1420,
|
|
|
|
strictPort: true,
|
2023-11-08 04:56:21 +03:00
|
|
|
hmr: mobile ? {
|
|
|
|
protocol: 'ws',
|
|
|
|
host: internalIpV4Sync(),
|
|
|
|
port: 1421
|
|
|
|
} : undefined,
|
2022-12-27 20:32:29 +03:00
|
|
|
},
|
2023-11-08 04:56:21 +03:00
|
|
|
})
|