Skip to content

Commit

Permalink
Added dotenv-expand to expand env vars (#2014)
Browse files Browse the repository at this point in the history
  • Loading branch information
colynb authored and devongovett committed Sep 16, 2018
1 parent 1bffd18 commit f4f3c16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/parcel/package.json
Expand Up @@ -38,6 +38,7 @@
"cssnano": "^4.0.0",
"deasync": "^0.1.13",
"dotenv": "^5.0.0",
"dotenv-expand": "^4.2.0",
"fast-glob": "^2.2.2",
"filesize": "^3.6.0",
"fswatcher-child": "^1.0.5",
Expand Down
4 changes: 3 additions & 1 deletion packages/core/parcel/src/utils/env.js
@@ -1,5 +1,6 @@
const config = require('./config');
const dotenv = require('dotenv');
const variableExpansion = require('dotenv-expand');

async function loadEnv(filepath) {
const NODE_ENV = process.env.NODE_ENV || 'development';
Expand All @@ -17,7 +18,8 @@ async function loadEnv(filepath) {
dotenvFiles.map(async dotenvFile => {
const envPath = await config.resolve(filepath, [dotenvFile]);
if (envPath) {
dotenv.config({path: envPath});
const envs = dotenv.config({path: envPath});
variableExpansion(envs)
}
})
);
Expand Down

0 comments on commit f4f3c16

Please sign in to comment.