Skip to content

Commit

Permalink
Add meta data for undefined type
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Jun 3, 2021
1 parent bf28bec commit 02bdd0c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/react-server/src/ReactFizzServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,13 +1032,27 @@ function renderElement(
}
}
let info = '';
if (__DEV__) {
if (
type === undefined ||
(typeof type === 'object' &&
type !== null &&
Object.keys(type).length === 0)
) {
info +=
' You likely forgot to export your component from the file ' +
"it's defined in, or you might have mixed up default and " +
'named imports.';
}
}
invariant(
false,
'Element type is invalid: expected a string (for built-in ' +
'components) or a class/function (for composite components) ' +
'but got: %s.%s',
type == null ? type : typeof type,
'',
info,
);
}

Expand Down

0 comments on commit 02bdd0c

Please sign in to comment.