feat: update deployment configuration and enhance VITE_API_BASE_URL handling

This commit is contained in:
Asep Haryana Saputra
2026-05-22 21:53:01 +00:00
parent 39039b4d27
commit 1d421ee948
5 changed files with 260 additions and 297 deletions
+2
View File
@@ -9,6 +9,8 @@ RUN bun install --frozen-lockfile
COPY packages/shared packages/shared
COPY apps/web apps/web
ARG VITE_API_BASE_URL
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
RUN bun run --cwd packages/shared build
RUN bun run --cwd apps/web build
+16 -11
View File
@@ -1,17 +1,22 @@
import react from '@vitejs/plugin-react';
import path from 'node:path';
import { defineConfig } from 'vite';
import { defineConfig, loadEnv } from 'vite';
export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api': 'http://localhost:3000',
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
const apiProxyTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:3000';
return {
plugins: [react()],
server: {
proxy: {
'/api': apiProxyTarget,
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
},
};
});