Simplify ReactRenderer API when referencing default modules

This commit is contained in:
SteveSandersonMS
2015-11-02 20:23:05 -08:00
parent 7e1955c6fe
commit 0c59f670b2
5 changed files with 7 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ module.exports = {
renderToString: function(callback, options) {
var resolvedPath = path.resolve(process.cwd(), options.moduleName);
var requestedModule = require(resolvedPath);
var component = requestedModule[options.exportName];
var component = options.exportName ? requestedModule[options.exportName] : requestedModule;
if (!component) {
throw new Error('The module "' + resolvedPath + '" has no export named "' + options.exportName + '"');
}