37 lines
929 B
TypeScript
37 lines
929 B
TypeScript
|
|
import { fileURLToPath, URL } from 'node:url';
|
||
|
|
|
||
|
|
import react from '@vitejs/plugin-react';
|
||
|
|
import { defineConfig } from 'vite';
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [react()],
|
||
|
|
resolve: {
|
||
|
|
// Mirrors the "@/*" path mapping in tsconfig.json.
|
||
|
|
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
|
||
|
|
},
|
||
|
|
server: {
|
||
|
|
host: true,
|
||
|
|
port: 5173,
|
||
|
|
// During development the SPA talks to Django through this proxy, so the
|
||
|
|
// browser only ever sees one origin and CORS never enters the picture.
|
||
|
|
proxy: {
|
||
|
|
'/api': {
|
||
|
|
target: process.env.VITE_PROXY_TARGET ?? 'http://localhost:8000',
|
||
|
|
changeOrigin: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
build: {
|
||
|
|
outDir: 'dist',
|
||
|
|
sourcemap: false,
|
||
|
|
rollupOptions: {
|
||
|
|
output: {
|
||
|
|
manualChunks: {
|
||
|
|
vendor: ['react', 'react-dom', 'react-router-dom'],
|
||
|
|
query: ['@tanstack/react-query'],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|