babel-plugin-global-define
The GlobalDefine plugin allows you to create global constants which is similar to Webpack's DefinePlugin
Usage
install
npm i babel-plugin-global-define --save-dev
.babelrc
"plugins":"global-define""__ENV__": "production"
Node API
Example
In
const hosts = development: 'https://test.github.com/' production: 'https://www.github.com/'const currentHost = hosts__ENV__
Out
const hosts = development: 'https://test.github.com/' production: 'https://www.github.com/'const currentHost = hosts"production"