diff --git a/lib/router/router.js b/lib/router/router.js index 1873002d..222499ab 100644 --- a/lib/router/router.js +++ b/lib/router/router.js @@ -199,6 +199,11 @@ export default class Router { } const { Component } = routeInfo + + if (typeof Component !== 'function') { + throw new Error(`The default export is not a React Component in page: "${pathname}"`) + } + const ctx = { pathname, query, asPath: as } routeInfo.props = await this.getInitialProps(Component, ctx)