1
0
Fork 0
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:
Tim Neutkens 2017-12-05 15:35:30 -08:00 committed by GitHub
parent 48ed89f93d
commit 4be6a521ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)