33 lines
889 B
JavaScript
33 lines
889 B
JavaScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { createRequire } from 'module';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const require = createRequire(import.meta.url);
|
|
const pkg = require('./package.json');
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
publicDir: 'client/public',
|
|
define: {
|
|
// Injected at build time — frontend reads this instead of maintaining a
|
|
// duplicate version string in client/lib/version.js
|
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
},
|
|
resolve: {
|
|
alias: { '@': path.resolve(__dirname, './client') },
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': { target: 'http://localhost:3000', changeOrigin: true },
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
emptyOutDir: true,
|
|
},
|
|
});
|