babel-plugin-transform-environment-variables-to-getters
The babel plugin to transform inline environment variables to value getters
Install
$ npm i babel-plugin-transform-environment-variables-to-getters
Example
In
consoleconsole
Out
.babelrc
with no options.exclude/include
Via
Out
// We can change __PROCESS_ENVS_GETTER__ with `webpack.DefinePlugin`const __getProcessEnvs = consoleconsole
.babelrc
with options
Via
Out
const __getProcessEnvs = console // process.env.NODE_DEBUG is excludedconsole
Object
options - envFilepath
path
the path of the environment file which should be a literal string - getterIdentifier?
string='__getProcessEnvs'
the identifier name of the env getter method - include?
Array<string>
keys to include. If not specified, all keys which are not excluded will be included - exclude?
Array<string>
keys to exclude.