Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"devDependencies": {
"@tauri-apps/cli": "^1.6.3",
"@types/node": "^22.14.1",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
File renamed without changes.
16 changes: 10 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import type { UserConfig } from 'vite';

// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
const host = process.env.TAURI_DEV_HOST ?? false;
const isTauri = Boolean(process.env.TAURI_DEBUG || process.env.TAURI_PLATFORM);

// https://vitejs.dev/config/
export default defineConfig(async () => ({
export default defineConfig({
plugins: [react()],

// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
Expand All @@ -16,7 +17,7 @@ export default defineConfig(async () => ({
server: {
port: 1420,
strictPort: true,
host: host || false,
host,
hmr: host
? {
protocol: "ws",
Expand All @@ -33,12 +34,15 @@ export default defineConfig(async () => ({
// Production optimizations
build: {
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13',
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,
rollupOptions: {
input: {
main: isTauri ? './index.html' : './public/index.html'
},
output: {
manualChunks: {
react: ['react', 'react-dom'],
Expand All @@ -47,4 +51,4 @@ export default defineConfig(async () => ({
}
}
}
}));
} satisfies UserConfig);