The package contains a Vite plugin to easily handle Laravel Valet sites in Secure mode with TLS.
You can install the package via yarn:
yarn add vite-laravel-valet-tls-plugin
or npm:
npm install vite-laravel-valet-tls-plugin --save
Register the plugin in your vite config:
import laravelValetTlsPlugin from 'vite-laravel-valet-tls-plugin'
export default defineConfig({
plugins: [
//
laravelValetTlsPlugin(),
//
],
});
Make sure you specify your Valet app url in your .env
:
MIX_APP_URL=http://my-app.test
Optionally, you could explicitly set the Valet app host when configuring the plugin:
import laravelValetTlsPlugin from 'vite-laravel-valet-tls-plugin'
export default defineConfig({
plugins: [
//
laravelValetTlsPlugin({
host: 'my-app.test'
}),
//
],
});
The plugin will now automatically handle the certificates for you whenever running Vite in development mode.
This package is based on an article by Freek from Spatie, which gave me an idea that this whole thing is possible.