Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/resolver/findExportedComponentDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import resolveExportDeclaration from '../utils/resolveExportDeclaration';
import resolveToValue from '../utils/resolveToValue';
import resolveHOC from '../utils/resolveHOC';

var ERROR_MULTIPLE_DEFINITIONS =
'Multiple exported component definitions found.';

function ignore() {
return false;
}
Expand Down Expand Up @@ -84,11 +81,11 @@ export default function findExportedComponentDefinition(
if (definitions.length === 0) {
return false;
}
if (definitions.length > 1 || definition) {
// If a file exports multiple components, ... complain!
throw new Error(ERROR_MULTIPLE_DEFINITIONS);

definition = definitions.map(def => resolveDefinition(def, types));
if (definition.length === 1) {
definition = definition.pop();
}
definition = resolveDefinition(definitions[0], types);
return false;
}

Expand Down Expand Up @@ -125,10 +122,6 @@ export default function findExportedComponentDefinition(
return false;
}
}
if (definition) {
// If a file exports multiple components, ... complain!
throw new Error(ERROR_MULTIPLE_DEFINITIONS);
}
definition = resolveDefinition(path, types);
return false;
},
Expand Down