fixed missing env

This commit is contained in:
2ManyProjects 2025-04-26 00:45:15 -05:00
parent 08bd77efb7
commit 3bde132b49

View file

@ -1,20 +1,9 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import dotenv from 'dotenv';
// https://vitejs.dev/config/
export default defineConfig(({mode}) => {
// Load env variables
const env = loadEnv(mode, process.cwd(), '');
// Determine HMR host based on environment
const isProduction = process.env.ENVIRONMENT === "prod";
const hmrHost = isProduction ? 'rocks.2many.ca' : 'localhost';
const hmrConfig = isProduction
? { host: hmrHost }
: { host: hmrHost, clientPort: 3000 };
return {
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
@ -46,7 +35,10 @@ export default defineConfig(({mode}) => {
watch: {
usePolling: true,
},
hmr: hmrConfig
hmr: {
clientPort: 3000,
host: 'localhost',
}
},
build: {
outDir: 'dist',
@ -54,5 +46,4 @@ export default defineConfig(({mode}) => {
emptyOutDir: true,
sourcemap: process.env.NODE_ENV !== 'production'
}
}
});