import fs from 'fs'; import {homedir} from 'os' import {resolve} from 'path' import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; import purge from '@erbelion/vite-plugin-laravel-purgecss' let host = 'playlab.test' export default defineConfig({ css: { devSourcemap: true }, resolve: { alias: { '~bootstrap': resolve(__dirname, 'node_modules/bootstrap'), } }, plugins: [ // inject({ // $: 'jquery', // jQuery: 'jquery', // include:'**.js' // }), laravel({ input: [ 'resources/js/img.js', 'resources/scss/app.scss', 'resources/scss/fa.scss', 'resources/scss/la.scss', 'resources/scss/google-fonts.scss', 'resources/scss/watch.scss', 'resources/scss/home.scss', // 'resources/vendor/css/fontawesome-all.min.css', // 'resources/vendor/css/line-awesome.min.css', 'resources/js/app.js', 'resources/js/home.js', 'resources/js/watch.js', 'resources/js/load-more.js', 'resources/js/jqfix.js', // 'resources/js/components/Player.js', ], refresh: {paths:['./resources/*','./resources/views/*','./resources/views/*/*', './resources/scss/*', './resources/scss/*/*', './resources/js/*'], config:true}, }), purge({ templates: ['blade'], safelist: { deep: [/dropdown-menu$/, /navbar$/], greedy: [/la-(long|facebook|linkedin|twitter|pinterest|plus-circle)/, /fa-(search|play)/, /show$/, /collapsing$/, /aos/, /data/, /reveal/, /show-filters/, /modal/, /collapsed/, /expand/, /slideout/, /^navbar/, /collapse/, /slick/, /prev/, /next/] }, }) ], server: detectServerConfig(host), }); function detectServerConfig(host) { let keyPath = resolve(homedir(), `.valet/Certificates/${host}.key`) let certificatePath = resolve(homedir(), `.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), }, } }