Skip to content

Commit

Permalink
fix(hmr): resolve HMR connection issues and environment variable hand…
Browse files Browse the repository at this point in the history
…ling

BREAKING CHANGES:
- Update Vite configuration for remote HMR
- Remove dotenv direct usage in frontend
- Use Vite's environment variable system
- Fix process not defined error

Features Added:
- Configure HMR for remote development
- Add proper public IP configuration
- Implement proper host/port settings

Technical Updates:
- Add VITE_PUBLIC_IP environment variable
- Configure Vite HMR client port and host
- Update environment variable access pattern
- Remove process-dependent code
- Fix WebSocket connection issues
  • Loading branch information
kurosakiaduma committed Jan 22, 2025
1 parent 5ed14de commit 3ee1748
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || "http://kenyare
export const FINANCIAL_AUDITS_DIR = 'audits';
export const PROPOSAL_FORMS_DIR = 'proposals';
export const QUOTATIONS_DIR = 'quotations';
export const DELETE_UPLOADS = process.env.DELETE_UPLOADS === "1";
export const DELETE_UPLOADS = import.meta.env.VITE_DELETE_UPLOADS === "1";
11 changes: 6 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import "dotenv/config";

export default defineConfig({
plugins: [sveltekit()],
preview: {
host: '0.0.0.0',
port: parseInt(process.env.VITE_PROD_PORT ?? "5173")
},
server: {
host: '0.0.0.0',
port: parseInt(process.env.VITE_DEV_PORT ?? "5173")
port: 5173,
hmr: {
// Set proper HMR configuration
clientPort: 5173,
host: '206.189.134.228' // Your server's public IP
}
}
});

0 comments on commit 3ee1748

Please sign in to comment.