I'd like inside my package.json execute some script which will set environment variables that my app could use. I need something like this (in my package.json)
"scripts": {
"dev": "set-env-vars.sh && webpack-dev-server --hot --inline & cd server && NODE_ENV=development node app.js",
},
This is my set-env-vars.sh file:
#!/bin/bash
export ENV_MONGODB_URI="mongodb://localhost:27017/mydb"
...
I know that I need use source or . to export my variables into shell, this is working in shell, but not for my package.json dev-script.
Any solutions to achieve that? Thank you.