Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pentateu/c445db7ce213351afa9a016e9e68cead to your computer and use it in GitHub Desktop.
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 !!!
/*
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