f14e58d42c
Prevents stale compiled .js files from shadowing their .tsx sources when the AI agent builds or type-checks the frontend. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import path from 'path'
|
|
import { execSync } from 'child_process';
|
|
|
|
const isDev = process.env.NODE_ENV === 'development' || process.env.vite === 'true';
|
|
|
|
let APP_VERSION = process.env.VITE_APP_VERSION || 'unknown';
|
|
let APP_GITSHA = process.env.VITE_APP_GITSHA || 'unknown';
|
|
|
|
if (isDev) {
|
|
APP_VERSION = 'DEV';
|
|
try {
|
|
APP_GITSHA = execSync('git rev-parse --short HEAD').toString().trim();
|
|
} catch (e) {
|
|
APP_GITSHA = 'unknown';
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
base: './',
|
|
plugins: [react(), tailwindcss()],
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(APP_VERSION),
|
|
__APP_GITSHA__: JSON.stringify(APP_GITSHA),
|
|
},
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.jsx', '.mjs', '.js', '.json'],
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
}) |