44 lines
1005 B
TypeScript
44 lines
1005 B
TypeScript
import path from 'node:path';
|
|
import react from '@vitejs/plugin-react';
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd());
|
|
return {
|
|
plugins: [react()],
|
|
server: {
|
|
port: 3000,
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
'/api': {
|
|
target: `http://localhost:5000/${env.VITE_BASE_URL}`,
|
|
changeOrigin: false,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
preview: {
|
|
port: 3000,
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
api: {
|
|
target: 'http://localhost:5000',
|
|
changeOrigin: false,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
components: path.resolve(__dirname, './src/components'),
|
|
hooks: path.resolve(__dirname, './src/hooks'),
|
|
pages: path.resolve(__dirname, './src/pages'),
|
|
styles: path.resolve(__dirname, './src/styles'),
|
|
types: path.resolve(__dirname, './src/types'),
|
|
contexts: path.resolve(__dirname, './src/contexts'),
|
|
},
|
|
},
|
|
};
|
|
});
|