41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
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'],
|
|
refresh: true,
|
|
}),
|
|
tailwindcss(),
|
|
],
|
|
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)),
|
|
},
|
|
},
|
|
|
|
})
|
|
}
|