Skip to content

Commit

Permalink
Make sure we show a nice message when there is no default export (ver…
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens authored Dec 5, 2017
1 parent 48ed89f commit 4be6a52
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 4be6a52

Please sign in to comment.