Search code examples
reactjsaws-amplifyvite

Get Amplify's Environment Variables on Vite React


How do I get Amplify's Environment Variable on a Vite React application? I've tried console logging to the import.meta.env, but only the process_env is showing. What do I need to do?


Solution

  • Please rename your environment variables so that they'd start with VITE_ prefix. According to the Vite documentation, any environment variable that does not start with VITE_ will not be exposed on the browser side for the purpose of preventing accidental leaking of variables.