- New tauri/ project: frameless 1280x800 window, loads the Vite dev server in dev and tauri/frontend_build in release builds. - Starts the backend on launch (node server.js in dev, pkg backend.exe sidecar in release) and stops it on exit through a Windows job object; reuses a backend already listening on port 4000. - Custom title bar works in Tauri (minimize, maximize, close, drag region) with the matching window capabilities. - react_frontend: dev:tauri / build:tauri scripts, shared platform flags so Electron and Tauri builds both use the local API and hash router. Web and Electron builds are unchanged. - tauri/README.md: prerequisites, dev, build, and gaps vs Electron.
34 lines
970 B
TypeScript
34 lines
970 B
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import path from 'path'
|
|
|
|
const isElectron = process.env.VITE_ELECTRON === 'true';
|
|
const isTauri = process.env.VITE_TAURI === 'true';
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
base: isElectron || isTauri ? './' : '/',
|
|
// Keep Rust/Tauri output visible in the terminal during `tauri dev`.
|
|
clearScreen: !isTauri,
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
port: 4200,
|
|
// Tauri loads devUrl http://localhost:4200, so never fall back to another port.
|
|
strictPort: isTauri,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://showyback.coolguy.space',
|
|
// target: 'http://localhost:4000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
allowedHosts: ['localhost', 'showyback.coolguy.space', 'showy.coolguy.space'],
|
|
},
|
|
})
|