68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import path from 'path'
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
import { viteMockServe } from 'vite-plugin-mock'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { VantResolver } from '@vant/auto-import-resolver'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
createSvgIconsPlugin({
|
|
// 指定需要缓存的图标文件夹
|
|
iconDirs: [path.resolve(process.cwd(), 'src/icons/svg')],
|
|
// 指定symbolId格式
|
|
symbolId: 'icon-[dir]-[name]'
|
|
}),
|
|
Components({
|
|
resolvers: [VantResolver()]
|
|
}),
|
|
viteMockServe({
|
|
mockPath: 'src/mock',
|
|
enable: false
|
|
})
|
|
],
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
additionalData: '@use "./src/styles/element/index.module.scss" as *;'
|
|
}
|
|
}
|
|
},
|
|
base: '/sweet-hut/',
|
|
resolve: {
|
|
// 配置路径别名
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src')
|
|
}
|
|
},
|
|
server: {
|
|
port: 5174,
|
|
// 服务器代理 服务器没有部署Nginx的情况下使用
|
|
proxy: {
|
|
'/home-api': {
|
|
target: 'http://127.0.0.1:8081',
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/home-api/, '')
|
|
},
|
|
'/alist-api': {
|
|
target: 'http://192.168.1.7:5244',
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/alist-api/, '')
|
|
},
|
|
'/image-api': {
|
|
target: 'http://192.168.1.7:3000',
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/image-api/, '')
|
|
},
|
|
'/agent-api': {
|
|
target: 'http://127.0.0.1:8000',
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/agent-api/, '')
|
|
}
|
|
}
|
|
}
|
|
})
|