Inaccurate error message when getStaticProps exported from page without a page component #34025
Labels
area: Developer Experience
Issues related to helping developers be more productive or show better errors
area: Static Generation
getStaticProps / getStaticPaths
good first issue
Easy to fix issues, good for newcomers


Run
next info(available from version 12.0.8 and up)What version of Next.js are you using?
12.0.11-canary.6
What version of Node.js are you using?
16.13.2
What browser are you using?
Firefox
What operating system are you using?
Ubuntu
How are you deploying your application?
next dev
Describe the Bug
When you have a page file which has a
getStaticPropsfunction exported, but no default export for a page component:You get this server error:
Even though the
getStaticPropsis correctly exported from the page.Expected Behavior
Ideally having no page component export would be allowed and not cause an error (it's useful in cases where you'd only ever return a redirect or an error), but if this isn't supported the error message should say something like
To Reproduce
next devThe text was updated successfully, but these errors were encountered: