Open mischlecht opened 6 years ago
You can simply require “dotenv“ lib, and access var from process.env.
Michael Schlecht notifications@github.com 於 2018年8月17日 週五 上午7:17 寫道:
Is there any way I can access my variables from the .env file in order to utilize them in my package.json scripts?
I'm attempting to store an API_KEY in the .env file and then pull it into a script in order to publish some bundles + source maps to Bugsnag.
If possible, I'd love to not have to hard code this API key in the script itself.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zetachang/react-native-dotenv/issues/49, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzRJSuTc65TYioiXvjXQVpOrWUVJYifks5uRf2CgaJpZM4WAuSD .
can I change it from package.json command?
Is there any way I can access my variables from the
.env
file in order to utilize them in mypackage.json
scripts?I'm attempting to store an API_KEY in the
.env
file and then pull it into a script in order to publish some bundles + source maps to Bugsnag.If possible, I'd love to not have to hard code this API key in the script itself.
I've attempted the following script in my
package.json
file:and, when run, have received the following output:
Any ideas how I can access variables in my
.env
file?