Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no error on multiple definitions (#213) #214

Closed
wants to merge 2 commits into from
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