Files
humanlayer/humanlayer-wui/vite.config.ts
Sundeep Malladi 465e6cab14 Add test dependencies and configure Vite to ignore test files
- Adds @types/bun dependency for TypeScript support in tests
- Configures Vite to ignore *.test.ts files in watch mode
- Updates bun.lock with new dependencies

These changes support the new test infrastructure while preventing test files
from triggering unnecessary rebuilds during development.
2025-07-29 14:49:14 -05:00

67 lines
1.7 KiB
TypeScript

import path from 'path'
import { defineConfig, PluginOption } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
const host = process.env.TAURI_DEV_HOST
const port = process.env.VITE_PORT ? parseInt(process.env.VITE_PORT) : 1420
const hmrPort = port + 1
/* React Dev Tools */
// https://eikowagenknecht.de/posts/using-react-devtools-with-tauri-v2-and-vite/
// https://react.dev/learn/react-developer-tools
// npm i -g react-devtools and then launch `react-devtools` in a terminal while your Tauri app is running
const reactDevTools = (): PluginOption => {
return {
name: 'react-devtools',
apply: 'serve', // Only apply this plugin during development
transformIndexHtml(html) {
return {
html,
tags: [
{
tag: 'script',
attrs: {
src: 'http://localhost:8097',
},
injectTo: 'head',
},
],
}
},
}
}
// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [react(), reactDevTools(), tailwindcss()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: port,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: 'ws',
host,
port: hmrPort,
}
: undefined,
watch: {
// 3. tell vite to ignore watching `src-tauri`
ignored: ['**/src-tauri/**', '**/*.test.ts'],
},
},
}))