38 lines
965 B
JavaScript
38 lines
965 B
JavaScript
|
|
import { defineConfig } from 'vite';
|
||
|
|
import react from '@vitejs/plugin-react';
|
||
|
|
import { viteSingleFile } from 'vite-plugin-singlefile';
|
||
|
|
|
||
|
|
// Set SINGLEFILE=1 to emit one self-contained index.html (all JS/CSS/fonts inlined).
|
||
|
|
const singleFile = process.env.SINGLEFILE === '1';
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [react(), ...(singleFile ? [viteSingleFile()] : [])],
|
||
|
|
server: {
|
||
|
|
host: true,
|
||
|
|
port: 3000
|
||
|
|
},
|
||
|
|
build: {
|
||
|
|
target: 'esnext',
|
||
|
|
outDir: 'dist',
|
||
|
|
sourcemap: false,
|
||
|
|
minify: 'terser',
|
||
|
|
// Inline every asset (including KaTeX fonts) as data URIs for the single file.
|
||
|
|
assetsInlineLimit: singleFile ? 100_000_000 : 4096,
|
||
|
|
cssCodeSplit: !singleFile,
|
||
|
|
chunkSizeWarningLimit: singleFile ? 6000 : 500
|
||
|
|
},
|
||
|
|
optimizeDeps: {
|
||
|
|
include: [
|
||
|
|
'@uiw/react-md-editor',
|
||
|
|
'katex',
|
||
|
|
'lucide-react',
|
||
|
|
'docx',
|
||
|
|
'mammoth',
|
||
|
|
'marked',
|
||
|
|
'rehype-katex',
|
||
|
|
'remark-math',
|
||
|
|
'file-saver'
|
||
|
|
]
|
||
|
|
}
|
||
|
|
});
|