Last active
February 3, 2017 01:40
-
-
Save pentateu/c445db7ce213351afa9a016e9e68cead to your computer and use it in GitHub Desktop.
log the value of PARKING_ENV during transpilation -> replaced by babel-plugin-transform-inline-environment-variables !!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Replace the contents of the file: | |
parking-agentsApp/node_modules/babel-plugin-transform-inline-environment-variables/lib/index.js | |
with the contents here to log the value of PARKING_ENV during the react-native transpilation. | |
*/ | |
/*istanbul ignore next*/"use strict"; | |
exports.__esModule = true; | |
exports.default = function ( /*istanbul ignore next*/_ref) { | |
/*istanbul ignore next*/var t = _ref.types; | |
return { | |
visitor: { /*istanbul ignore next*/ | |
MemberExpression: function MemberExpression(path) { | |
if (path.get("object").matchesPattern("process.env")) { | |
var key = path.toComputedKey(); | |
if (t.isStringLiteral(key)) { | |
if (key.value === 'PARKING_ENV') { | |
console.log('## key found: ', key.value); | |
console.log('## process.env[key.value]: ', process.env[key.value]); | |
} | |
path.replaceWith(t.valueToNode(process.env[key.value])); | |
} | |
} | |
} | |
} | |
}; | |
}; | |
/*istanbul ignore next*/module.exports = exports["default"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment