-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
45 lines (44 loc) · 1.02 KB
/
vite.config.js
File metadata and controls
45 lines (44 loc) · 1.02 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig({
plugins: [vue()],
// 设置基础路径,开发环境使用'/',生产环境使用'./'
base: process.env.NODE_ENV === 'production' ? './' : '/',
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
optimizeDeps: {
include: [
'pdfjs-dist',
'mammoth',
'xlsx',
'marked',
'highlight.js',
'file-saver'
],
// 排除pdfjs-dist的worker文件,避免被优化
exclude: ['pdfjs-dist/build/pdf.worker.min.mjs']
},
build: {
// 增加兼容性配置
target: 'es2015',
// 关闭文件大小警告
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: {
manualChunks: {
vendor: ['vue', 'element-plus'],
converters: ['mammoth', 'xlsx', 'pdfjs-dist'],
utils: ['marked', 'highlight.js', 'file-saver']
}
}
}
},
server: {
port: 5173,
open: true
}
})