Files
pda-overseas-uniapp/vite.config.js
T
2026-08-26 15:24:51 +08:00

37 lines
1.0 KiB
JavaScript

import { defineConfig, loadEnv } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const domesticTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000'
const overseasTarget = env.OVERSEAS_API_PROXY_TARGET || 'http://127.0.0.1:9300'
return {
plugins: [uni()],
server: {
proxy: {
'/api': { target: domesticTarget, changeOrigin: true },
'/overseas-api': {
target: overseasTarget,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/overseas-api/, '/api')
}
}
},
css: {
preprocessorOptions: {
scss: {
// DCloud uni-scss still uses APIs deprecated by the bundled Dart Sass.
// Keep real Sass warnings/errors visible while hiding these known notices.
silenceDeprecations: [
'legacy-js-api',
'import',
'global-builtin',
'color-functions',
'if-function'
]
}
}
}
}
})