ddev-viteserve
ddev-viteserve copied to clipboard
How to specify path to custom vite config file?
I am trying to use a custom local vite config file as such:
ddev vite-serve start --config=vite.config.local.js
How can I achieve this?
I took a quick look at my implementation of the start command, and right now, the script wants to find the config file in the VITE_PROJECT_DIR, using the default name of vite.config.js.
To get the script to find the main config file under a different name, I'd need to pass the name/path to the vite process as I launch it. This wouldn't be difficult to do (the code is in ddev-viteserve/commands/web/vite-serve), but I'm a bit tied up at the moment and it might be a while before I could look into this.
What's your use-case for changing the name? Why do you want to do this?
@torenware Hey, thanks for getting back to me. Here is a discussion I had on DDEV for a point of reference: https://github.com/ddev/ddev/issues/5018#issuecomment-1606156194
I am not in a rush, but I would have to avoid using this package for the time being and resort to a more manual approach described here: https://github.com/mandrasch/ddev-laravel-vite
If you are busy, I could look into implementing a PR for you when I get some time this weekend.
My use case is that I don't want to burden the main vite.config.js file with my personal local development setup... people are suggesting that I add various condition checks based on some env variables, but that still means that I would have to pack the vite.config.js with potentially useless bloat.
I want my personal local dev setup to not influence the project files, which includes vite.config.js- there may be more people working on this project and I cannot guarantee what dev setup they have locally.
So, if I decouple my dev setup in vite.config.js into my own vite.config.local.js then that would resolve my problem.
In the link above, I also describe how vite has a mergeConfig() method, which allows you to extend the base vite.config.js and override or extend the config.