Permalink
Browse files

fix(constructor): support entities as es6 default export

  • Loading branch information...
ppvg committed Oct 29, 2016
1 parent e87fb8e commit 2b529bdbfa1b1b24f95324c43bf581487d85c884
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/Wetland.ts
@@ -82,11 +82,16 @@ export class Wetland {
.filter(match => match.search(/\.js$/) > -1)
.map(entity => entity.replace(/\.js$/, ''))
.forEach(entity => {
let filePath = path.resolve(entityPath, entity);
let ToRegister = require(filePath);
let filePath = path.resolve(entityPath, entity);
let entityModule = require(filePath);
let ToRegister = entityModule;
if (typeof ToRegister !== 'function') {
ToRegister = ToRegister[entity];
ToRegister = entityModule.default;
}
if (typeof ToRegister !== 'function') {
ToRegister = entityModule[entity];
}
if (typeof ToRegister !== 'function') {

0 comments on commit 2b529bd

Please sign in to comment.