62cbbf525c
Fixes SSG pages that start with `/api` not being detected as SSG pages. This also adds tests to ensure this is working correctly in the `prerender` suite. x-ref: https://github.com/vercel/next.js/issues/17091
27 lines
452 B
JavaScript
27 lines
452 B
JavaScript
import { useRouter } from 'next/router'
|
|
|
|
export const getStaticProps = () => {
|
|
return {
|
|
props: {
|
|
hello: 'world',
|
|
},
|
|
}
|
|
}
|
|
|
|
export const getStaticPaths = () => {
|
|
return {
|
|
paths: ['/api-docs/first'],
|
|
fallback: true,
|
|
}
|
|
}
|
|
|
|
export default function Slug(props) {
|
|
if (useRouter().isFallback) return 'Loading...'
|
|
|
|
return (
|
|
<>
|
|
<p id="api-docs">API Docs</p>
|
|
<p id="props">{JSON.stringify(props)}</p>
|
|
</>
|
|
)
|
|
}
|