51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
'@components': path.resolve(__dirname, 'src/components'),
|
|
'@pages': path.resolve(__dirname, 'src/pages'),
|
|
'@utils': path.resolve(__dirname, 'src/utils'),
|
|
'@config': path.resolve(__dirname, 'src/config'),
|
|
'@contexts': path.resolve(__dirname, 'src/contexts'),
|
|
'@assets': path.resolve(__dirname, 'src/assets'),
|
|
},
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
|
|
},
|
|
optimizeDeps: {
|
|
include: ['react-apexcharts', 'apexcharts'],
|
|
esbuildOptions: {
|
|
target: 'es2020',
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: true,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
vendor: ['react', 'react-dom', 'react-router-dom', 'antd'],
|
|
charts: ['react-apexcharts', 'apexcharts'],
|
|
},
|
|
},
|
|
},
|
|
target: 'es2020',
|
|
commonjsOptions: {
|
|
include: [/node_modules/],
|
|
},
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
open: true,
|
|
host: true,
|
|
strictPort: true,
|
|
},
|
|
}); |