mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix issue related to 404 and no default exports. (#2063)
Just after a 404 page, if we created a page with no default exports. It'll throw an error. And it'll crash internal webpack state. So, once we have it we need to do a hard reload to recover it.
This commit is contained in:
parent
9121a9d22e
commit
787a110b75
|
@ -30,7 +30,16 @@ export default () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { err } = Router.components[route] || {}
|
const { err, Component } = Router.components[route] || {}
|
||||||
|
|
||||||
|
if (!Component) {
|
||||||
|
// This only happens when we create a new page without a default export.
|
||||||
|
// If you removed a default export from a exising viewing page, this has no effect.
|
||||||
|
console.log(`Hard reloading due to no default component in page: ${route}`)
|
||||||
|
window.location.reload()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
// reload to recover from runtime errors
|
// reload to recover from runtime errors
|
||||||
Router.reload(route)
|
Router.reload(route)
|
||||||
|
|
Loading…
Reference in a new issue