33 lines
714 B
JavaScript
33 lines
714 B
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { execSync } from 'child_process'
|
|
|
|
let commitHash = process.env.COMMIT_REF
|
|
? process.env.COMMIT_REF.slice(0, 7)
|
|
: '';
|
|
|
|
if (!commitHash) {
|
|
try {
|
|
commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
|
} catch (e) {
|
|
commitHash = 'dev';
|
|
}
|
|
}
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
define: {
|
|
__COMMIT_HASH__: JSON.stringify(commitHash)
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api-wpp': {
|
|
target: 'http://www.c2wpp.c2sistemas.com.br:22700',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api-wpp/, '')
|
|
}
|
|
}
|
|
}
|
|
})
|