Vite config for multiple development setups
I'm working on a Laravel 10 project together with a friend. We both use different detups in our development. I use Laravel from a homestead setup and my friend uses sail in combination with docker.
My vite.config.js with homestead looks as follows:
import { defineConfig } from 'vite'; import laravel, { refreshPaths } from 'laravel-vite-plugin';
export default defineConfig({ plugins: [ laravel({ input: [ 'resources/css/app.css', 'resources/js/app.js', ], refresh: [ ...refreshPaths, 'app/Http/Livewire/**', ], }), ], server: { host: "192.168.56.56", watch: { usePolling: true, }, },
}); My friends version with sail is:
import { defineConfig } from 'vite'; import laravel, { refreshPaths } from 'laravel-vite-plugin';
export default defineConfig({ plugins: [ laravel({ input: [ 'resources/css/app.css', 'resources/js/app.js', ], refresh: [ ...refreshPaths, 'app/Http/Livewire/**', ], }), ],
}); The latter also works with our deployment scripts for automated production build.
Is there any way I can have both configurations in the vite.config.js file without needing to change them every time?
Tried to exclude vite.config.js from git, but this causes also the automated production deployment to stop working, so it would be great to be able to have both configurations in there.
Please or to participate in this conversation.