Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #149 from cerebrl/master
Browse files Browse the repository at this point in the history
Support ES6 module syntax for React views.
  • Loading branch information
samsel committed Apr 13, 2016
2 parents 666d34d + 51b24e0 commit bafd210
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ exports.create = function create(createOptions) {

var view = require(thing);

// Check for an ES6 `default` property on the module export
// ------------------------------------------------------------
// TypeScript and Babel users that leverage ES6 module depend on this
// e.g. `export default function MyView() {};`
if (view.default) {
view = view.default;
}

// create the Component using react's createFactory
var component = React.createFactory(view);
return done(null, renderAndDecorate(component(data), data, html));
Expand Down

0 comments on commit bafd210

Please sign in to comment.