Transparently require()
jsx from node with babel
This version change default extension from .js
to .jsx
, due to .js
extension overwrite base node parser and will case an exception.
require('node-jsx-babel').install()
If you want to use a different extension than .jsx
, do:
require('node-jsx-babel').install({extension: '.foo'})
If you want to couple with an additional transform (such as CoffeeScript), do:
var coffee = require('coffee-script');
require('node-jsx-babel').install({
extension: '.coffee',
additionalTransform: function(src) {
return coffee.compile(src, {
'bare': true
});
}
});
This version was build for React v0.14 branch, with babel transformer.