2024-10-21 09:05:15 +08:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-10-23 09:48:48 +08:00
|
|
|
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/, "")
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2024-10-21 09:05:15 +08:00
|
|
|
})
|