Open OliverJAsh opened 9 years ago
I don't see, how you can use it - there is no way to pass different factory to jsx-transform, so without it will it be useless?
Like this?
var jsx = require('jsx-transform');
jsx.fromString('<h1>Hello World</h1>', {
factory: 'mercury.h'
});
// => 'mercury.h("h1", null, ["Hello World"])'
@OliverJAsh yeah, but in client code it will be more like this:
var component = require('component.jsx');
And in component.jsx
you have only one choise:
var React = require('react');
export <h1></h1>;
Afaik there is no way to configure jspm plugin atm.
@guybedford Is there any way to provide configuration options to a plugin, or could there be?
Yes - meta configuration can do this:
System.config({
meta: {
'some/file.js': {
loader: 'jsx',
customOption: 'asdf'
}
}
});
Sorry for asking silly questions, but how would you read that custom option from within the plugin?
metadata
is passed as a property on the load object in the hooks.
Could we use jsx-transform for users who are using JSX with non-React virtual DOM implementations?
https://github.com/alexmingoia/jsx-transform