babel-plugin-dotenv
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -33,4 +33,3 @@ var dotEnv = require('dotenv'); | ||
var localId = specifier.local.name; | ||
if(!config[importedId]) { | ||
if(!(config.hasOwnProperty(importedId))) { | ||
throw path.get('specifiers')[idx].buildCodeFrameError('Try to import dotenv variable "' + importedId + '" which is not defined in any ' + configFile + ' files.') | ||
@@ -41,5 +40,3 @@ } | ||
binding.referencePaths.forEach(function(refPath){ | ||
if (config[importedId]) { | ||
refPath.replaceWith(t.valueToNode(config[importedId])) | ||
} | ||
refPath.replaceWith(t.valueToNode(config[importedId])) | ||
}); | ||
@@ -46,0 +43,0 @@ }) |
{ | ||
"name": "babel-plugin-dotenv", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Load environment variables from .env file using import statement", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,2 +35,7 @@ var babel = require("babel-core"); | ||
it('should load empty variable as empty string ', function(){ | ||
var result = babel.transformFileSync('test/fixtures/empty-values/source.js') | ||
expect(result.code).to.be('\'use strict\';\n\nconsole.log(\'abc123\');\nconsole.log(\'username\');\nconsole.log(\'\');') | ||
}) | ||
it('should load let .env.development overwrite .env', function(){ | ||
@@ -37,0 +42,0 @@ var result = babel.transformFileSync('test/fixtures/dev-env/source.js') |
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
9162
35
118