New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-global-define

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-global-define - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "babel-plugin-global-define",
"version": "1.0.1",
"version": "1.0.2",
"description": "The GlobalDefine plugin allows you to create global constants which is similar to Webpack's DefinePlugin.",

@@ -5,0 +5,0 @@ "main": "lib",

# babel-plugin-global-define
The GlobalDefine plugin allows you to create global constants which is similar to Webpack's DefinePlugin
## Usage
### .babelrc
``` javascript
{
"plugins": [
["global-define", {
"__ENV__": "production",
}]
]
}
```
### Node API
``` javascript
require("babel-core").transform("foo();", {
plugins: [
["global-define", { "__ENV__": "production" }]
]}
})
```
## Example
### In
```javascript
const hosts = {
development: 'https://test.github.com/',
production: 'https://www.github.com/'
}
const currentHost = hosts[__ENV__]
````
### Out
```javascript
const hosts = {
development: 'https://test.github.com/',
production: 'https://www.github.com/'
}
const currentHost = hosts["production"]
````
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc