mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 02:09:08 +03:00
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import path from 'path';
|
|
import react from '@vitejs/plugin-react';
|
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
import { dependencies } from './package.json';
|
|
|
|
function renderChunks(deps: Record<string, string>) {
|
|
const chunks = {};
|
|
Object.keys(deps).forEach(key => {
|
|
if (['@chakra-ui/react', '@chakra-ui/icons', 'framer-motion'].includes(key)) chunks[key] = [key];
|
|
return;
|
|
});
|
|
return chunks;
|
|
}
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
root: './',
|
|
base: '/educt-client/',
|
|
publicDir: 'public',
|
|
plugins: [react()],
|
|
server: {
|
|
port: 5000,
|
|
},
|
|
resolve: {
|
|
alias: [{ find: '@educt', replacement: path.resolve(__dirname, 'src') }],
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: 'assets/[name]-[hash].js',
|
|
chunkFileNames: 'assets/[name].[hash].js',
|
|
manualChunks: {
|
|
...renderChunks(dependencies),
|
|
},
|
|
},
|
|
plugins: [visualizer()],
|
|
},
|
|
outDir: 'dist',
|
|
sourcemap: false,
|
|
},
|
|
});
|