Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
73 lines (72 loc) · 2.04 KB
/
Copy pathvite.config.ts
File metadata and controls
73 lines (72 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { copyFileSync, cpSync, existsSync } from 'fs';
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
{
name: 'copy-seo-files',
closeBundle() {
try {
copyFileSync('robots.txt', 'dist/robots.txt');
copyFileSync('sitemap.xml', 'dist/sitemap.xml');
console.log('✓ Copied robots.txt and sitemap.xml to dist/');
} catch (err) {
console.warn('Warning: Could not copy SEO files:', err.message);
}
try {
const katexFontsSource = resolve('node_modules/katex/dist/fonts');
const katexFontsDest = resolve('dist/fonts');
if (existsSync(katexFontsSource)) {
cpSync(katexFontsSource, katexFontsDest, { recursive: true });
console.log('✓ Copied KaTeX fonts to dist/fonts/');
}
} catch (err) {
console.warn('Warning: Could not copy KaTeX fonts:', err.message);
}
}
}
],
build: {
rollupOptions: {
output: {
manualChunks: {
// Separate chunk for PDF processing
'pdf-worker': ['pdfjs-dist'],
// Separate chunk for file processing utilities
'file-processing': ['mammoth', 'exceljs', 'heic2any'],
// Separate chunk for UI components
'ui-components': ['lucide-react'],
// KaTeX math rendering
'katex': ['katex', 'remark-math', 'rehype-katex'],
// Vendor chunk for React and core dependencies
'vendor': ['react', 'react-dom', 'localforage']
}
}
}
},
optimizeDeps: {
exclude: ['lucide-react'],
include: [
'pdfjs-dist',
'pdfjs-dist/build/pdf.worker.min.js',
'jspdf',
'jspdf-autotable',
'docx',
'mammoth',
'exceljs',
'heic2any',
'katex',
'remark-math',
'rehype-katex'
]
},
define: {
global: 'globalThis',
},
worker: {
format: 'es'
}
});