forked from itchaox/MarkdownPreviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
52 lines (47 loc) · 1.33 KB
/
vite.config.js
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
/*
* @Version : v1.00
* @Author : itchaox
* @Date : 2023-06-21 11:48
* @LastAuthor : Wang Chao
* @LastTime : 2025-02-21 13:45
* @desc :
*/
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
// https://vitejs.dev/config/
export default defineConfig({
base: './',
server: {
host: true,
hmr: true, //启动热更新,就是更改了代码自动刷新页面
// open: true, //代表vite项目在启动时自动打开浏览器
proxy: {
'/api': {
target: 'https://open.feishu.cn',
//你的需要请求的服务器地址
changeOrigin: true, // 允许跨域
secure: false, //忽略安全证书
rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径把路径变成空字符,
},
},
},
plugins: [
vue(),
AutoImport({
imports: ['vue', 'vue-router', 'pinia'],
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
});