I decided to create a new project today, then I created a new laravel project and it's coming with a new assets compiler, vite. But my project requires SSL in local development, then I needed to make the vite works together with SSL and laravel valet.

Let's go, first assure your domain already have SSL with the command: cd ~/Code/your-current-project valet secure your-current-project Now check in the browser your domain it's working with the certificate.

Check the file example bellow 👇 import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; import vue from '@vitejs/plugin-vue'; const domain = "domain.test"; // add it const homedir = require("os").homedir(); // add it export default defineConfig({ plugins: [ laravel({ input: "resources/js/app.js", ssr: "resources/js/ssr.js", }), vue({ template: { transformAssetUrls: { base: null, includeAbsolute: false, }, }, }), ], // add this block server: { https: { key: homedir + "/.config/valet/Certificates/" + domain + ".key", cert: homedir + "/.config/valet/Certificates/" + domain + ".crt", }, host: domain, hmr: { host: domain, }, }, }); I hope this article helped you!
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners