All API functions have the option { viteConfig: { /*...*/ }}. (It's the only option.)
We generally recommend to define your Vite settings in your vite.config.js file instead of using the viteConfig option. The API automatically loads your vite.config.js file (just like the CLI).
If you want to define Vite settings outside of your app (typically when building your own framework) you can do this:
If you want to define your entire Vite config programmatically: