There is a few API keys that I need access to in Sage and I am looking for the best way to store them. Ideally I would like to pull the variables in the .env file in Bedrock’s /Site so I can get access to the different environments.
I have added dotenv-webpack to webpack.config.js but haven’t been able to access the variables in main.js. Is there something I am missing?
Thanks a lot for your help! This confirms my suspicion. I installed Dotenv quickly but was getting a “fs dependency was not found” and didn’t look further into it.
For anyone looking for an answer, here is what I used to access my .env variables through Webpack: new webpack.DefinePlugin({ 'process.env': JSON.stringify(dotenv.parsed) })