1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import laravel from 'laravel-vite-plugin'
- import { defineConfig } from 'vite'
- import fs from 'fs';
- import { homedir } from 'os'
- import { resolve } from 'path'
- let host = 'orion4.test'
- export default defineConfig({
- plugins: [
- laravel({
- input: 'resources/js/app.js',
- refresh: true,
- }),
- ],
- server: detectServerConfig(host),
- })
- function detectServerConfig(host) {
- let keyPath = resolve(homedir(), `.config/valet/Certificates/${host}.key`)
- let certificatePath = resolve(homedir(), `.config/valet/Certificates/${host}.crt`)
- if (!fs.existsSync(keyPath)) {
- return {}
- }
- if (!fs.existsSync(certificatePath)) {
- return {}
- }
- return {
- hmr: {host},
- host,
- https: {
- key: fs.readFileSync(keyPath),
- cert: fs.readFileSync(certificatePath),
- },
- watch: {
- usePolling: true,
- }
- }
- }
|