lycx-hx/vite.config.ts

57 lines
1.0 KiB
TypeScript

import path from 'path'
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import Unocss from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'@/': `${path.resolve(__dirname, 'src')}/`,
},
},
plugins: [
uni(),
// https://github.com/antfu/unocss
Unocss(),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: [
'vue',
'uni-app',
'pinia',
],
dts: true,
vueTemplate: true,
}),
],
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler" // or 'modern'
}
}
},
server: {
port: 9529,
open: false,
proxy: {
"/api": {
target: "https://hex.jipinq.cn",
changeOrigin: true,
// pathRewrite: {
// '^/api': '/'
// },
rewrite: (path) => {
console.log(path)
return path.replace(/^\/api/, "")
},
},
},
}
})