mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
BREAKING CHANGE Since `next export` has been printing a deprecation warning since https://github.com/vercel/next.js/pull/47376, its safe to remove in semver-major. The upgrade path is to simply add `output: 'export'` in `next.config.js` - everything will continue to work the same. This config greatly improves the `next dev` experience today. And in the future, it will improve performance of `next build` because we no longer need to do two passes (build then export).
41 lines
910 B
JavaScript
41 lines
910 B
JavaScript
import Link from 'next/link'
|
|
|
|
export async function getStaticProps({ params: { slug } }) {
|
|
if (slug[0] === 'delayby3s') {
|
|
await new Promise((resolve) => setTimeout(resolve, 3000))
|
|
}
|
|
|
|
return {
|
|
props: {
|
|
slug,
|
|
},
|
|
}
|
|
}
|
|
|
|
export async function getStaticPaths() {
|
|
return {
|
|
paths: [
|
|
{ params: { slug: ['first'] } },
|
|
'/catchall-explicit/second',
|
|
{ params: { slug: ['another', 'value'] } },
|
|
'/catchall-explicit/hello/another',
|
|
'/catchall-explicit/[first]/[second]',
|
|
{ params: { slug: ['[third]', '[fourth]'] } },
|
|
],
|
|
fallback: false,
|
|
}
|
|
}
|
|
|
|
export default function Page({ slug }) {
|
|
// Important to not check for `slug` existence (testing that build does not
|
|
// render fallback version and error)
|
|
return (
|
|
<>
|
|
<p id="catchall">Hi {slug.join(' ')}</p>{' '}
|
|
<Link href="/" id="home">
|
|
to home
|
|
</Link>
|
|
</>
|
|
)
|
|
}
|