26 lines
592 B
JavaScript
26 lines
592 B
JavaScript
import { defineConfig } from 'vite';
|
|
import { execSync } from 'child_process';
|
|
import uni from '@dcloudio/vite-plugin-uni';
|
|
|
|
let appVersion = '1.0.0';
|
|
try {
|
|
appVersion = execSync('git describe --tags --abbrev=0 2>/dev/null || echo "1.0.0"', { encoding: 'utf8' }).trim().replace(/^v/, '');
|
|
} catch {}
|
|
|
|
export default defineConfig({
|
|
plugins: [uni()],
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(appVersion),
|
|
},
|
|
server: {
|
|
port: 8888,
|
|
strictPort: true,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3006',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
});
|