-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
62 lines (61 loc) · 1.54 KB
/
vite.config.ts
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
import path from 'path'
import { defineConfig } from 'vite'
import topLevelAwait from "vite-plugin-top-level-await"
import vue from '@vitejs/plugin-vue'
import wasm from "vite-plugin-wasm"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), wasm(), topLevelAwait()],
clearScreen: false,
server: {
port: 3000,
proxy: {
'/data': {
target: 'http://127.0.0.1:13956/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/data/, '')
},
'/resource': {
target: 'http://127.0.0.1:13956/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/resource/, '')
}
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'pdfjs-dist-types': '/src/@types/pdfjs-dist-types.d.ts',
}
},
build: {
rollupOptions: {
input: {
index: 'index.html',
},
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
const arr = id.toString().split('node_modules/')[1].split('/')
switch (arr[0]) {
case 'element-plus':
return '_' + arr[0]
case 'pdfjs-dist':
if (id.includes('pdf.worker')) {
return '_pdfjs_worker';
}
return '_pdfjs';
default:
return '_vendor'
}
}
}
}
},
chunkSizeWarningLimit: 1100,
},
optimizeDeps: {
include: ['pdfjs-dist'],
exclude: ['md_wasm', 'sim'],
},
})