27 lines
627 B
TypeScript
27 lines
627 B
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { readFileSync } from 'fs';
|
|
import { dirname, join } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const pkg = JSON.parse(
|
|
readFileSync(join(__dirname, 'package.json'), 'utf-8'),
|
|
) as { version: string };
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
define: {
|
|
__FE_VERSION__: JSON.stringify(pkg.version),
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
});
|