From c8260118bc87fd199a99ae7a7ab05cd053a7eeab Mon Sep 17 00:00:00 2001 From: Brett Patterson Date: Sat, 1 Mar 2025 16:22:36 -0500 Subject: [PATCH] Add documentation about Laravel + Vite --- changelog.md | 3 +++ environments/laravel.md | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 environments/laravel.md diff --git a/changelog.md b/changelog.md index 15d6dd3..1353bd3 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Change Log +## UNRELEASED +* Add documentation about running vite in Warden for Laravel ([wardenenv/warden#846](https://github.com/wardenenv/warden/issues/846) by @bap14) + ## Version [0.14.1](https://github.com/wardenenv/warden/tree/0.14.1) (2023-07-10) [All Commits](https://github.com/wardenenv/warden/compoare/0.14.0..0.14.1) diff --git a/environments/laravel.md b/environments/laravel.md new file mode 100644 index 0000000..ba5e2b6 --- /dev/null +++ b/environments/laravel.md @@ -0,0 +1,25 @@ +# Warden Laravel Environment + +## Laravel + Vite + +Starting with Laravel 9.x Vite was added as an asset bundler. Starting with Warden +0.15.1 you can run the vite development server within the Warden container. + +To fully support running the vite development server within the Warden container +you need to adjust your `vite.config.js` file: + +```javascript +export default defineConfig({ + server: { + host: true, // Tell's Vite to listen on all IP addresses; could also use '0.0.0.0' + port: 5173, + strictPort: true, // Don't let Vite choose a different port + origin: `https://vite..test`, // Replace with your Warden environment name + allowedHosts: ['..test'], // Replace with your Warden environment name + cors: { + origin: /https?:\/\/([A-Za-z0-9\-\.]+)?(.+\.test)(?::\d+)?$/, // Allow any `.test` domain + } + }, + // ... The rest of your existing configuration ... +}); +```