so essentially, for the purposes of testing locally, I need to define my API keys in a .env file and the only place I can read them into my code is in my server.js file.
as an example, let's say in my server.js, I have the following code with the necessary imports:
const {api_key1, api_key2} = process.env;
I thought I would try to be clever and try the following:
export default {api_key1, api_key2};
so I could then import server from 'server.js'; from a front end javascript file, like index.js.
Of course, I tried running that and was greeted with SyntaxError: Unexpected token export
TLDR: What's the best way to transfer these environment variables into other JSX files?
Follow up edits:
when I try const {apikey1, apikey2} = process.env in index.js, I get Reference Error: Process is not defined
when I try adding a require('dotenv').config() above the process.env call, I get Module not found: can't resolve 'fs' in ..node_modules\dotenv\lib