25 lines
662 B
TypeScript
25 lines
662 B
TypeScript
import { defineConfig } from 'vite';
|
|
import uniPlugin from '@dcloudio/vite-plugin-uni';
|
|
|
|
const uni = typeof uniPlugin === 'function' ? uniPlugin : uniPlugin.default;
|
|
const devPort = Number(process.env.PORT) || 5175;
|
|
const devHost = process.env.HOST || '0.0.0.0';
|
|
const proxyTarget = process.env.VITE_PROXY_TARGET || 'https://wygj-api.localhost';
|
|
|
|
export default defineConfig({
|
|
plugins: [uni()],
|
|
server: {
|
|
host: devHost,
|
|
port: devPort,
|
|
strictPort: true,
|
|
proxy: {
|
|
'/dev-api': {
|
|
target: proxyTarget,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/dev-api/, '')
|
|
}
|
|
}
|
|
}
|
|
});
|