Skip to content

Instantly share code, notes, and snippets.

@adeleke5140
Created May 12, 2022 23:19
Show Gist options
  • Save adeleke5140/2435d16847bcd74bc44fa82a328dd2bc to your computer and use it in GitHub Desktop.
Save adeleke5140/2435d16847bcd74bc44fa82a328dd2bc to your computer and use it in GitHub Desktop.
Regarding Environmental Variables

When using Vite to bootstrap a react app, the .env file must be in the same directory as the package.json and not in the src directory.

After that, import it with import.meta.env.VITE_API_KEY

P.S: VITE_API_KEY is the name of the environmental variable you initally created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment