48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
const rootDir = fileURLToPath(new URL('.', import.meta.url))
|
|
const projectRoot = path.resolve(rootDir, '..')
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(rootDir, 'src'),
|
|
'@shared': path.resolve(projectRoot, 'shared'),
|
|
},
|
|
},
|
|
server: {
|
|
fs: {
|
|
allow: [projectRoot],
|
|
},
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://127.0.0.1:3333',
|
|
changeOrigin: true,
|
|
},
|
|
'/uploads': {
|
|
target: 'http://127.0.0.1:3333',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
'vendor-react': ['react', 'react-dom', 'react-router-dom'],
|
|
'vendor-mui': ['@mui/material', '@mui/icons-material', '@emotion/react', '@emotion/styled'],
|
|
'vendor-swiper': ['swiper/react', 'swiper/modules'],
|
|
'vendor-query': ['@tanstack/react-query'],
|
|
'vendor-effector': ['effector', 'effector-react'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|