react-mixin-transformer
react-mixin-transformer
is a transformer for use with webpack
and
esprima-loader
. It allows you to pass in an array of mixins
that you want
to inject into all of your React
components.
TODO
- Write tests.
Install
npm install esprima-loader --save-dev
npm install react-mixin-transformer --save-dev
Usage
ReactMixinTransformerReactMixinTransformer
[array]
- Array of Strings of the Mixins you want to inject.boolean
- Boolean, of whether to display verbose logging during the transform process.
Webpack Config Example
// webpack.config.jsvar webpack = ;var path = ;var ReactMixinTransformer = ; moduleexports = module: loaders: test: /\.jsx$/ exclude: /node_modules/ loader: 'esprima!react-hot!babel-loader?experimental&optional=runtime' plugins: ReactDebuggerMixin: path esprima: transforms: ReactMixinTransformer
Notes
It is recommended you make the mixins
that you want to inject available via
webpack
's ProvidePlugin
.
Resources
- Esprima AST Explorer
- esprima-loader
- webpack plugins
- React Conf 2015 - AST Transformations
- estraverse
- component-flow-loader
- reactiflux - Slack for React developers
Special Thanks
- @iamdustan, for
esprima-loader
and the pointers. - @gurdasnijor, for the great intro about
AST
transformations at React Conf.