-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathvite.config.js
43 lines (42 loc) · 1.04 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
import { defineConfig } from 'vite'
import sassDts from 'vite-plugin-sass-dts';
import react from '@vitejs/plugin-react'
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), sassDts()],
// 配置快捷路径
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'~': path.resolve(__dirname, 'src')
},
},
// 配置scss样式自动引入
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "./src/styles/var.scss";`
}
}
},
server: {
proxy: {
'/baidu': {
target: 'https://openapi.baidu.com/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/baidu/, ''),
},
'/qiniu': {
target: 'https://rsf.qiniuapi.com/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/qiniu/, ''),
},
'/ai': {
target: 'https://spark-api-open.xf-yun.com/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/ai/, ''),
},
},
},
})