-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
37 lines (36 loc) · 943 Bytes
/
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
import {defineConfig} from 'vite'
import * as path from 'path'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
base: '/ds-cash/',
server: {
host: true,
proxy: {
'/api': {
// 当遇到 /api 路径时,将其转换成 target 的值
target: 'http://127.0.0.1:3000/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), // 将 /api 重写为空
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
utils: path.resolve(__dirname, 'src/utils'),
'#': path.resolve(__dirname, 'types'),
},
},
css: {
preprocessorOptions: {
scss: {
// mixin和variable里面是函数和变量等供scss使用的非实体css, scss-loader需要
additionalData: `
@import "@/assets/scss/variable.scss";
`,
},
},
},
plugins: [react()],
})