2026-08-26 15:24:51 +08:00
|
|
|
import { defineConfig, loadEnv } from 'vite'
|
2026-08-20 20:10:20 +08:00
|
|
|
import uni from '@dcloudio/vite-plugin-uni'
|
|
|
|
|
|
2026-08-26 15:24:51 +08:00
|
|
|
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 {
|
2026-08-26 09:58:35 +08:00
|
|
|
plugins: [uni()],
|
2026-08-26 15:24:51 +08:00
|
|
|
server: {
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': { target: domesticTarget, changeOrigin: true },
|
|
|
|
|
'/overseas-api': {
|
|
|
|
|
target: overseasTarget,
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
rewrite: (path) => path.replace(/^\/overseas-api/, '/api')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-08-26 09:58:35 +08:00
|
|
|
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'
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-08-26 15:24:51 +08:00
|
|
|
}
|
2026-08-20 20:10:20 +08:00
|
|
|
})
|