2026-01-12 12:23:44 +08:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [vue()],
|
2026-01-18 09:08:38 +08:00
|
|
|
server: {
|
|
|
|
|
host: true,
|
2026-02-15 23:23:00 +08:00
|
|
|
port: 5173,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/v1': {
|
2026-04-05 23:22:00 +08:00
|
|
|
target: 'https://api.imageteach.tech:8002',
|
2026-02-15 23:23:00 +08:00
|
|
|
changeOrigin: true
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-18 09:08:38 +08:00
|
|
|
},
|
2026-02-14 18:28:37 +08:00
|
|
|
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('/', '-')}`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-01-18 09:08:38 +08:00
|
|
|
optimizeDeps: {
|
|
|
|
|
include: [
|
|
|
|
|
'@milkdown/crepe',
|
|
|
|
|
'@milkdown/vue',
|
2026-04-11 09:24:14 +08:00
|
|
|
'@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'
|
2026-01-18 09:08:38 +08:00
|
|
|
]
|
|
|
|
|
}
|
2026-01-12 12:23:44 +08:00
|
|
|
})
|