Files
doormilxpress_astryx/vite.config.js
2026-08-26 15:01:15 +05:30

43 lines
1.4 KiB
JavaScript

import path from 'node:path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
// `@/*` resolves to `src/*`. Declared here rather than through a plugin so the
// alias is the same one `jsconfig.json` reports to the editor.
export default defineConfig({
define: {
'process.env': {},
},
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(import.meta.dirname, './src'),
'utils': path.resolve(import.meta.dirname, './src/utils'),
'themes': path.resolve(import.meta.dirname, './src/themes'),
'components': path.resolve(import.meta.dirname, './src/components'),
'pages': path.resolve(import.meta.dirname, './src/pages'),
'assets': path.resolve(import.meta.dirname, './src/assets'),
'api': path.resolve(import.meta.dirname, './src/api'),
},
},
build: {
rollupOptions: {
output: {
// Split the heavy libraries out of the app bundle. They change far less
// often than app code, so browsers keep them cached across deploys.
manualChunks: {
react: ['react', 'react-dom', 'react-router-dom'],
charts: ['recharts'],
motion: ['framer-motion'],
map: ['leaflet', 'react-leaflet'],
sheets: ['xlsx'],
},
},
},
},
server: {
// Honor a port assigned by the environment; fall back to Vite's default.
port: process.env.PORT ? Number(process.env.PORT) : 5173,
},
});