How to extend the vite config? #388
-
Hello, Excellent work creating reactivated btw, but I'm having issues with some packages that require modify default Vite config. How can I achieve this? I review the code of reactivated library, but I didn't find a reliable way to achieve this. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Thanks for the kind words. Theoretically, a I imagine if you tweak the config too much things would break. I'm not 100% sure how the merging is done, but it's done automatically. But that's the behavior I observed when developing it. Also look at https://vite.dev/guide/api-javascript#mergeconfig Start small, maybe try enabling an additional plugin and ensure the plugin is getting appended to the existing ones rather than replacing. For reference, there's two sets of config: for dev and for production. https://github.com/silviogutierrez/reactivated/blob/main/packages/reactivated/src/vite.mts https://github.com/silviogutierrez/reactivated/blob/main/packages/reactivated/src/build.client.mts |
Beta Was this translation helpful? Give feedback.
Thanks for the kind words.
Theoretically, a
vite.config.ts
in the root folder will just get "picked up". And with some black magic, vite itself merges it with the "mandatory" vite configuration.I imagine if you tweak the config too much things would break. I'm not 100% sure how the merging is done, but it's done automatically.
But that's the behavior I observed when developing it.
Also look at https://vite.dev/guide/api-javascript#mergeconfig
Start small, maybe try enabling an additional plugin and ensure the plugin is getting appended to the existing ones rather than replacing.
For reference, there's two sets of config: for dev and for production.
https://github.com/silviogutierrez/reac…