babel-plugin-react-transform
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -105,4 +105,4 @@ 'use strict'; | ||
var pluginOptions = file.opts.extra['react-transform']; | ||
if (!Array.isArray(pluginOptions) || pluginOptions.length === 0) { | ||
throw new Error('babel-plugin-react-transform requires that you specify ' + 'extras["react-transform"] in .babelrc ' + 'or in your Babel Node API call options, and that it is an array ' + 'with more than zero elements.'); | ||
if (!Array.isArray(pluginOptions)) { | ||
throw new Error('babel-plugin-react-transform requires that you specify ' + 'extras["react-transform"] in .babelrc ' + 'or in your Babel Node API call options, and that it is an array.'); | ||
} | ||
@@ -109,0 +109,0 @@ return pluginOptions; |
{ | ||
"name": "babel-plugin-react-transform", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Babel plugin to instrument React components with custom transforms", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -46,21 +46,31 @@ # babel-plugin-react-transform | ||
"stage": 0, | ||
"plugins": [ | ||
"react-transform" | ||
], | ||
"extra": { | ||
// must be defined and be an array | ||
"react-transform": [{ | ||
// can be an NPM module name or a local path | ||
"target": "react-transform-webpack-hmr", | ||
// see specific transform's docs for "imports" and "locals" it needs | ||
"imports": ["react"], | ||
"locals": ["module"] | ||
}, { | ||
// you can have many transforms, not just one | ||
"target": "react-transform-catch-errors", | ||
"imports": ["react", "redbox-react"] | ||
}, { | ||
// can be an NPM module name or a local path | ||
"target": "./src/my-custom-transform" | ||
}] | ||
"env": { | ||
// this plugin will be included only in development mode, e.g. | ||
// if NODE_ENV (or BABEL_ENV) environment variable is not set | ||
// or is equal to "development" | ||
"development": { | ||
"plugins": [ | ||
// Include babel-plugin-react-display-name if you’re | ||
// using React.createClass() *before* react-transform: | ||
// "react-display-name", | ||
"react-transform" | ||
], | ||
"extra": { | ||
// must be defined and be an array | ||
"react-transform": [{ | ||
// can be an NPM module name or a local path | ||
"target": "react-transform-webpack-hmr", | ||
// see specific transform's docs for "imports" and "locals" it needs | ||
"imports": ["react"], | ||
"locals": ["module"] | ||
}, { | ||
// you can have many transforms, not just one | ||
"target": "react-transform-catch-errors", | ||
"imports": ["react", "redbox-react"] | ||
}, { | ||
// can be an NPM module name or a local path | ||
"target": "./src/my-custom-transform" | ||
}] | ||
} | ||
} | ||
} | ||
@@ -196,2 +206,4 @@ } | ||
When using `React.createClass()` and allowing `babel` to extract the `displayName` property you must ensure that [babel-plugin-react-display-name](https://github.com/babel/babel/tree/development/packages/babel-plugin-react-display-name) is included before `react-transform`. See [this github issue](https://github.com/gaearon/babel-plugin-react-transform/issues/19) for more details. | ||
## Discussion | ||
@@ -198,0 +210,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
72172
30
1497
223