-
Notifications
You must be signed in to change notification settings - Fork 12
/
vite.config.ts
48 lines (47 loc) · 1.1 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import autoImport from 'unplugin-auto-import/vite'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
autoImport({
dts: './shims/auto-imports.d.ts',
imports: ['vue']
})
],
base: '/Vue3-TS-ChatGPT/',
build: {
outDir: 'docs',
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
const match = id.match(/node_modules[/\\]\.pnpm[/\\](.+?)[@/\\]/)
if (match) {
const pkg = match[1].replace(/@.+/, '')
return `vendor/${pkg}`
}
return 'vendor/' + id.split('node_modules/')[1].split('/')[0].toString()
}
}
}
}
},
server: {
port: 8888,
// proxy: {
// '/api': {
// target: 'https://api.openai.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// }
// }
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
}
})