babel-plugin-transform-dev
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -12,4 +12,9 @@ # Changelog | ||
## 1.1.0 (November 29, 2015) | ||
- **New Feature** | ||
- Add `evaluate` option | ||
## 1.0.0 (November 29, 2015) | ||
First public release. |
@@ -11,3 +11,4 @@ 'use strict'; | ||
var expr = template('"production" !== process.env.NODE_ENV'); | ||
var expr = template('"production" !== process.env.NODE_ENV')(); | ||
var bool = t.booleanLiteral('production' !== process.env.NODE_ENV); | ||
@@ -18,3 +19,3 @@ return { | ||
if (t.isIdentifier(path.node, { name: '__DEV__' })) { | ||
path.replaceWith(expr()); | ||
path.replaceWith(this.opts.evaluate ? bool : expr); | ||
} | ||
@@ -21,0 +22,0 @@ } |
{ | ||
"name": "babel-plugin-transform-dev", | ||
"version": "1.0.0", | ||
"description": "A plugin for Babel v6 which replaces \"__DEV__\" with \"'production' !== process.env.NODE_ENV\".", | ||
"version": "1.1.0", | ||
"description": "A plugin for Babel v6 which replaces `__DEV__` with `'production' !== process.env.NODE_ENV`.", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -6,5 +6,9 @@ # babel-plugin-transform-dev | ||
Replaces `__DEV__` with `process.env.NODE_ENV !== 'production'`. | ||
Replaces all occurrences of `__DEV__` in your JavaScript code with `"production" !== process.env.NODE_ENV`. | ||
Make sure to put this plugin before other plugins that might transform `process.env`. | ||
You can also set the plugin's `evaluate` option to `true` in order to replace `__ENV__` with the result of evaluating `"production" !== process.env.NODE_ENV` at build time. | ||
## Installation | ||
@@ -11,0 +15,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4764
20
63