locally i use a .env file and do the following:
const value = import.meta.env.VITE_VALUETOGET
console.log("value", value )
When i go to production however i use the azure portal configuration app settings and added VITE_VALUETOGET with the value, this doesn't work because i get undefined if i try to log it.
I also tried to use pipeline to deploy the app and export the values from azure vault before i deploy it but nothing seems to work, process.env neither.
I also tried vite.config.js:
export default defineConfig({
mode: 'production',
plugins: [
react(),
// Add the replace plugin to inject environment variables
replace({
'import.meta.env.VITE_VALUETOGET': JSON.stringify(process.env.VITE_VALUETOGET)
}),
],
});