60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import path from 'path'
|
|
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { TanStackRouterVite } from '@tanstack/router-vite-plugin'
|
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
|
|
export default defineConfig(({ mode }) => ({
|
|
plugins: [
|
|
TanStackRouterVite({
|
|
routesDirectory: './src/routes',
|
|
autoCodeSplitting: true,
|
|
}),
|
|
react(),
|
|
tailwindcss(),
|
|
// pnpm --filter web analyze → dist/stats.html
|
|
...(mode === 'analyze'
|
|
? [visualizer({ filename: 'dist/stats.html', gzipSize: true })]
|
|
: []),
|
|
],
|
|
build: {
|
|
// Вендорные чанки меняются реже кода приложения → лучше кэш браузера между релизами.
|
|
rolldownOptions: {
|
|
output: {
|
|
advancedChunks: {
|
|
groups: [
|
|
{
|
|
name: 'vendor-react',
|
|
test: /node_modules[\\/](react|react-dom|scheduler)[\\/]/,
|
|
},
|
|
{ name: 'vendor-tanstack', test: /node_modules[\\/]@tanstack[\\/]/ },
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
'@authportal/shared': path.resolve(__dirname, '../../packages/shared/src/index.ts'),
|
|
'@authportal/ui/components': path.resolve(__dirname, '../../packages/ui/src/components'),
|
|
'@authportal/ui/hooks': path.resolve(__dirname, '../../packages/ui/src/hooks'),
|
|
'@authportal/ui/lib': path.resolve(__dirname, '../../packages/ui/src/lib'),
|
|
},
|
|
},
|
|
server: {
|
|
port: 5175,
|
|
fs: {
|
|
allow: [path.resolve(__dirname, '../..')],
|
|
},
|
|
proxy: {
|
|
'/api': 'http://localhost:8080',
|
|
'/health': 'http://localhost:8080',
|
|
'/ready': 'http://localhost:8080',
|
|
'/.well-known': 'http://localhost:8080',
|
|
'/oauth': 'http://localhost:8080',
|
|
},
|
|
},
|
|
}))
|