Does Doppler support with import.meta.env?

Hey Everyone!

I wanted to ask if anyone out there has gotten Doppler to work withimport.meta.env? We have a web application that uses ViteJs and thus only supports import.meta.env. I haven’t found any documentation (maybe I missed it. I’m not sure) talking about working with import.meta with Doppler.

To give some context, I got Doppler setup and logged import.meta.env to see if it was populated with the Doppler secrets but it seems like it was not.

Any help would be greatly appreciated.

Thanks!

Hi @Derrick_Bol and welcome to the Doppler community!

All you need to do is prefix your secrets with the required VITE_ prefix, e.g. VITE_KEY_1 which would then be available at {import.meta.env.VITE_KEY_1}.

1 Like

I’ve also added a Vite and Svelte environment variables guide to our documentation.

1 Like

Amazing, @ryan-blunden. Thanks for helping out. I can confirm that this is working.

1 Like

Awesome @Derrick_Bol!