41 lines
930 B
TypeScript
41 lines
930 B
TypeScript
import path from 'path'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import react from '@vitejs/plugin-react-swc'
|
|
import { defineConfig, loadEnv } from 'vite'
|
|
import checker from 'vite-plugin-checker'
|
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
|
|
return {
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
tsconfigPaths(),
|
|
checker({
|
|
typescript: true,
|
|
eslint: {
|
|
lintCommand: 'eslint "./src/**/*.{ts,tsx}"',
|
|
useFlatConfig: true,
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: env.VITE_API_BASE_URL,
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
},
|
|
},
|
|
},
|
|
}
|
|
})
|