refactor: rename local environment mode to localhost and add startup configuration logging

This commit is contained in:
azeeee05
2026-07-09 14:38:59 +05:30
parent 66f562c3a1
commit 9a9bcfd3cd
3 changed files with 12 additions and 6 deletions
View File
+3 -3
View File
@@ -5,16 +5,16 @@
"type": "module",
"scripts": {
"dev": "vite --mode dev",
"local": "vite --mode local",
"local": "vite --mode localhost",
"test": "vite --mode test",
"uat": "vite --mode uat",
"build:dev": "tsc -b && vite build --mode dev",
"build:local": "tsc -b && vite build --mode local",
"build:local": "tsc -b && vite build --mode localhost",
"build:test": "tsc -b && vite build --mode test",
"build:uat": "tsc -b && vite build --mode uat",
"lint": "eslint .",
"preview:dev": "vite preview --mode dev",
"preview:local": "vite preview --mode local",
"preview:local": "vite preview --mode localhost",
"preview:test": "vite preview --mode test",
"preview:uat": "vite preview --mode uat"
},
+9 -3
View File
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
@@ -6,7 +6,7 @@ import tailwindcss from '@tailwindcss/vite'
export default defineConfig(({ mode }) => {
// Environment-specific configuration
const envConfig = {
local: {
localhost: {
port: 5174,
strictPort: false,
},
@@ -24,7 +24,13 @@ export default defineConfig(({ mode }) => {
},
}
const serverConfig = envConfig[mode as keyof typeof envConfig] || envConfig.local
const serverConfig = envConfig[mode as keyof typeof envConfig] || envConfig.localhost
const env = loadEnv(mode, process.cwd(), '')
console.log(`\n======================================`)
console.log(`🚀 Starting frontend in [${mode}] mode`)
console.log(`🔗 Backend API URL: ${env.VITE_API_URL || 'NOT SET'}`)
console.log(`======================================\n`)
return {
plugins: [