-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
42 lines (41 loc) · 1.09 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path' // 编辑器提示 path 模块找不到,可以yarn add @types/node --dev
import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
export default defineConfig({
plugins: [
vue(),
Components({
resolvers: [AntDesignVueResolver()],
}),
],
resolve: {
alias: {
'@': resolve(__dirname, 'src') // 设置 `@` 指向 `src` 目录
}
},
server: {
port: 3088, // 设置服务启动端口号
open: false, // 设置服务启动时是否自动打开浏览器
hmr: true,
// 代理
proxy: {
'/api': {
target: 'http://127.0.0.1:8899',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
}
},
build: {
rollupOptions: {
output: {
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'js/[name]-[hash].js',
assetFileNames: '[ext]/[name]-[hash].[ext]',
},
},
chunkSizeWarningLimit: 500
}
})