Inline dotenv at build-time with babel-plugin-macros.
$ yarn add dotenv.macro
Note: You'll also need to install and configure babel-plugin-macros if you haven't already.
// .env
HOST=localhost
EXPAND_NODE_ENV="NODE_ENV=${NODE_ENV}"
// index.js
import { HOST } from 'dotenv.macro';
console.log(HOST);
↓ ↓ ↓ ↓ ↓ ↓
console.log(process && process.env && process.env.HOST || "localhost");
- node >= 9.4.0
- yarn >= 1.3.2
$ yarn install --pure-lockfile
$ yarn run format
$ yarn run eslint
$ yarn run test:watch
$ yarn run build
- ⇄ Pull requests and ★ Stars are always welcome.
- For bugs and feature requests, please create an issue.
- Pull requests must be accompanied by passing automated tests.