x-control-panel/web-ui/vue-app/vite.config.ts

31 lines
748 B
TypeScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import { execSync } from 'child_process'
export default defineConfig({
plugins: [
vue(),
{
name: 'generate-rpc-client',
buildStart() {
console.log('🔄 Generating RPC client before build...')
try {
execSync('npx tsx scripts/generate-rpc-client.ts', {
stdio: 'inherit',
cwd: process.cwd()
})
} catch (error) {
console.error('❌ Failed to generate RPC client:', error)
throw error
}
}
}
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})