import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), '');

  console.log(`Active mode: ${mode}`);
  console.log('Environment variable loaded:', env);

  return {
    plugins: [react()],
    server: {
      https: {
        key: env.VITE_SSL_KEY_PATH,
        cert: env.VITE_SSL_CERT_PATH,
      },
      host: '0.0.0.0',
      port: 5173,
    },
  };
});