Reputation: 137
I'm building a web-site, and using Firebase to store data. So, the private keys are on a .env file. I'm trying to import them in a firebase config file. I'm using import in order to use modules. And by following the guide in the dotenv doc, I ran 'node -r dotenv/config main.jsx' on my terminal. But I got an error, and I don't understand what to do. Thanks !
Upvotes: 1
Views: 165
Reputation: 982
It seems you are using Vite which already supports .env files.
It's exposed in the import.meta.env
object. Try replacing process.env.
for import.meta.env.
in your code.
See the documentation here: https://vitejs.dev/guide/env-and-mode.html#env-files
Upvotes: 1