2024-07-25 18:49:59 +08:00
|
|
|
import { defineConfig } from 'vite'
|
2024-07-27 15:58:41 +08:00
|
|
|
import sassDts from 'vite-plugin-sass-dts';
|
2024-07-25 18:49:59 +08:00
|
|
|
import react from '@vitejs/plugin-react'
|
2024-07-25 20:28:03 +08:00
|
|
|
import path from 'path';
|
2024-07-25 18:49:59 +08:00
|
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
|
export default defineConfig({
|
2024-07-27 15:58:41 +08:00
|
|
|
plugins: [react(), sassDts()],
|
|
|
|
|
// 配置快捷路径
|
2024-07-25 20:28:03 +08:00
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
2024-07-27 15:38:56 +08:00
|
|
|
'@': path.resolve(__dirname, './src'),
|
|
|
|
|
'~': path.resolve(__dirname, 'src')
|
2024-07-25 20:28:03 +08:00
|
|
|
},
|
2024-07-27 15:58:41 +08:00
|
|
|
},
|
|
|
|
|
// 配置scss样式自动引入
|
|
|
|
|
css: {
|
|
|
|
|
preprocessorOptions: {
|
|
|
|
|
scss: {
|
2024-10-26 14:34:41 +08:00
|
|
|
additionalData: `@use "./src/styles/var.scss";`
|
2024-07-27 15:58:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-08-15 12:51:09 +08:00
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
2024-09-26 21:15:00 +08:00
|
|
|
target: 'https://openapi.baidu.com/',
|
2024-08-15 12:51:09 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
|
|
|
},
|
2024-08-20 12:56:21 +08:00
|
|
|
'/qiniu': {
|
2024-09-26 21:15:00 +08:00
|
|
|
target: 'https://rsf.qiniuapi.com/',
|
2024-08-20 12:56:21 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
rewrite: (path) => path.replace(/^\/qiniu/, ''),
|
|
|
|
|
},
|
2024-09-26 21:15:00 +08:00
|
|
|
'/ai': {
|
|
|
|
|
target: 'https://spark-api-open.xf-yun.com/',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
rewrite: (path) => path.replace(/^\/ai/, ''),
|
|
|
|
|
},
|
2024-08-15 12:51:09 +08:00
|
|
|
},
|
|
|
|
|
},
|
2024-07-25 18:49:59 +08:00
|
|
|
})
|