fix(ui): Loading .env
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig, loadEnv } from 'vite'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
// Define backend URL with port from environment variable or default to 8080
|
export default defineConfig(({ mode }) => {
|
||||||
const backendUrl = `http://${process.env.BACKEND_HOST || 'localhost'}:${process.env.BACKEND_PORT || '3000'}`
|
// Load environment variables
|
||||||
|
const env = loadEnv(mode, process.cwd(), '')
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// Define backend URL with port from environment variable or default to 8080
|
||||||
export default defineConfig({
|
const backendUrl = `http://${env.BACKEND_HOST || 'localhost'}:${env.BACKEND_PORT || '3000'}`
|
||||||
|
|
||||||
|
return {
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
base: '/app', // Set the base path for production builds
|
base: '/app', // Set the base path for production builds
|
||||||
server: {
|
server: {
|
||||||
@@ -29,4 +32,6 @@ export default defineConfig({
|
|||||||
'/actions': backendUrl,
|
'/actions': backendUrl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user