mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Make sure we show a nice message when there is no default export (#3400)
This commit is contained in:
parent
48ed89f93d
commit
4be6a521ed
|
@ -199,6 +199,11 @@ export default class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { Component } = routeInfo
|
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 }
|
const ctx = { pathname, query, asPath: as }
|
||||||
routeInfo.props = await this.getInitialProps(Component, ctx)
|
routeInfo.props = await this.getInitialProps(Component, ctx)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue