38 lines
891 B
JavaScript
38 lines
891 B
JavaScript
import { defineConfig } from 'vite'
|
|
import uni from '@dcloudio/vite-plugin-uni'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const rootDir = path.dirname(fileURLToPath(import.meta.url))
|
|
|
|
export default defineConfig({
|
|
plugins: [uni()],
|
|
resolve: {
|
|
alias: {
|
|
'@': rootDir,
|
|
},
|
|
},
|
|
server: {
|
|
host: '127.0.0.1',
|
|
port: 4403,
|
|
strictPort: true,
|
|
proxy: {
|
|
// H5 开发:api/config.js 默认 baseURL 为 /proxy-api,转发到 Go 后端
|
|
'/proxy-api': {
|
|
// target: 'http://127.0.0.1:9000',
|
|
target: 'https://api.yunzer.cn',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/proxy-api/, ''),
|
|
},
|
|
},
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
// 关闭废弃 API 警告
|
|
silenceDeprecations: ['legacy-js-api', 'color-functions', 'import'],
|
|
},
|
|
},
|
|
},
|
|
})
|