-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.main.config.mts
49 lines (47 loc) · 1.16 KB
/
vite.main.config.mts
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
import { viteStaticCopy } from 'vite-plugin-static-copy'
import { defineConfig } from 'vite';
import path from "path";
export const checkIncludes = (id:string)=>{
return ['node_modules/typescript','node_modules/js-tiktoken','node_modules/@babel','node_modules/undici'].reduce((acc, str)=>{
return acc || id.includes(str)
},false)
}
export default defineConfig({
optimizeDeps:{
exclude:['typescript']
},
build:{
sourcemap: false,
minify:false,
rollupOptions:{
output: {
manualChunks(id) {
if(checkIncludes(id)){
return 'lib'
}
}
}
}
},
publicDir:'./src/assets',
resolve: {
// Some libs that can run in both Web and Node.js, such as `axios`, we need to tell Vite to build them in Node.js.
// mainFields: ['node','module', 'jsnext:main', 'jsnext'],
alias: {
'@': path.resolve(__dirname, 'src'),
'uuid': 'node_modules/uuid/dist/esm-node/index.js',
'ws': 'node_modules/ws/index.js'
},
},
plugins:[
viteStaticCopy({
targets: [
{
src: 'src/loaders/parse',
dest: './'
}
]
}),
// Inspect()
]
});