Files
llm-in-text/vite.config.js
ydy0615 70152c61b1 feat: enhance Milkdown editor and file system functionality
- Normalize line endings in Markdown export for DOCX files.
- Improve selection serialization to Markdown with better handling of empty documents.
- Add a new `updateFile` function to the file system for updating file properties.
- Introduce video transcoding capabilities using FFmpeg, supporting various video formats.
- Update AGENTS.md for clearer plugin structure and responsibilities.
- Add scoped styles for TreeNodeItem component to improve UI consistency.
- Implement cross-origin isolation headers in Vite configuration for enhanced security.
- Remove obsolete test_cross.py file.
2026-05-01 20:55:02 +08:00

79 lines
2.2 KiB
JavaScript

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const crossOriginIsolationHeaders = {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin'
}
export default defineConfig({
plugins: [vue()],
server: {
host: true,
port: 5173,
headers: crossOriginIsolationHeaders,
proxy: {
'/v1': {
target: 'https://api.imageteach.tech:8002',
changeOrigin: true
}
}
},
preview: {
headers: crossOriginIsolationHeaders
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (!id.includes('node_modules')) return
const modulePath = id.split('node_modules/')[1]
const segments = modulePath.split('/')
const packageName = segments[0].startsWith('@')
? `${segments[0]}/${segments[1]}`
: segments[0]
if (packageName.startsWith('@milkdown')) return 'milkdown'
if (packageName.startsWith('prosemirror')) return 'prosemirror'
if (packageName.startsWith('@codemirror')) {
const langMatch = modulePath.match(/@codemirror\/lang-([^/]+)/)
if (langMatch) return `cm-lang-${langMatch[1]}`
return `cm-${segments[1]}`
}
if (packageName === 'refractor') {
const langMatch = modulePath.match(/refractor\/lang\/([^./]+)/)
if (langMatch) return `refractor-lang-${langMatch[1]}`
return 'refractor-core'
}
if (packageName.startsWith('katex')) return 'katex'
if (packageName.startsWith('markdown-it')) return 'markdown'
if (packageName === 'vue' || packageName.startsWith('@vue')) return 'vue'
return `vendor-${packageName.replace('@', '').replace('/', '-')}`
}
}
}
},
optimizeDeps: {
include: [
'@milkdown/crepe',
'@milkdown/vue',
'@milkdown/kit',
'@univerjs/core',
'@univerjs/design',
'@univerjs/engine-render',
'@univerjs/engine-formula',
'@univerjs/ui',
'@univerjs/presets',
'@univerjs/preset-docs-core',
'@univerjs/preset-sheets-core',
'@univerjs/slides',
'@univerjs/slides-ui'
]
}
})