mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This ensures `env` keys in `next.config` are properly exposed during page collecting step during build since the inlining step comes after. x-ref: https://github.com/vercel/next.js/pull/70380 x-ref: https://vercel.com/vercel/vercel-site/9WqUX9vu15oVEy1acDqoXddcH27K?filter=errors
20 lines
364 B
JavaScript
20 lines
364 B
JavaScript
import { useRouter } from 'next/router'
|
|
|
|
export default function Page(props) {
|
|
return (
|
|
<>
|
|
<p>hello from ssg</p>
|
|
<p id="query">{JSON.stringify(useRouter().query)}</p>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export function getStaticProps() {
|
|
if (!process.env.LEGACY_ENV_KEY) {
|
|
throw new Error('missing env key LEGACY_ENV_KEY!!')
|
|
}
|
|
return {
|
|
props: {},
|
|
}
|
|
}
|