Hi, I’m building a website using vite js. I like the dev server (as almost everyone does, it’s fast and has live reload), but I need to replace some stuff in the code. So let’s say I have a variable that is equal to a random object, I want to replace that. In The dev server it cloud be something that might be for testing, but in prod it would need to change depending on who is requesting it, so I need to replace the variable. I can build it in my express server but I would love it in the dev server. Is there a way to do this? Thanks in advance!
I found the define property in the vite config. It adds variables that can be whatever name you want and whatever value. It is an object and the key is the name of the variable I want to add and the value is the value for the variable. It works great!