import {defineConfig, loadEnv} from 'vite' import laravel from 'laravel-vite-plugin' import tailwindcss from '@tailwindcss/vite' import { fileURLToPath, URL } from 'node:url' export default ({mode}) => { const env = loadEnv(mode, process.cwd(), '') const host = env.VITE_DEV_HOST || '127.0.0.1' const port = Number(env.VITE_DEV_PORT || 5173) const origin = env.VITE_DEV_ORIGIN || env.APP_URL || 'https://localhost' const hmrHost = env.VITE_HMR_HOST || (new URL(origin)).hostname return defineConfig({ plugins: [ laravel({ input: ['resources/css/app.css', 'resources/js/app.js', 'resources/js/app-webmail.js'], refresh: true, }), tailwindcss(), ], server: { host: '0.0.0.0', port: 5173, strictPort: true, hmr: { host: 'ui.dev.mail.nexlab.at', protocol: 'wss', clientPort: 443, path: '/vite-hmr', }, cors: true, watch: { ignored: ['**/storage/framework/views/**'], }, }, // server: { // host, // port, // https: false, // TLS übernimmt Nginx // strictPort: true, // hmr: { // protocol: env.VITE_HMR_PROTOCOL || 'wss', // host: hmrHost, // clientPort: Number(env.VITE_HMR_CLIENT_PORT || 443), // }, // origin, // }, resolve: { alias: { '@plugins': fileURLToPath(new URL('./resources/js/plugins', import.meta.url)), }, }, }) }