stack/packages/stack-sc/src/index.react-server.ts
Konsti Wohlwend 057dac1a66
Some checks failed
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Next.js 15 support (#315)
Updates `examples/demo` to Next.js 15 and adds Next.js 15 support to `packages/stack`.

The other packages and apps are still running on Next.js 14 to ensure compatibility.
2024-11-08 03:12:31 +01:00

11 lines
773 B
TypeScript

export const isReactServer = true;
// In Next.js 15, the `next/headers` module returns async functions.
// Since we support both Next.js 14 and 15, we return a union of the two.
// TODO: Remove this once we drop support for Next.js 14, and replace it with `export { cookies, headers } from 'next/headers';`
// https://nextjs.org/blog/next-15#async-request-apis-breaking-change
import { cookies as nextCookies, headers as nextHeaders } from './next-static-analysis-workaround';
export const cookies = nextCookies as typeof nextCookies | ((...args: Parameters<typeof nextCookies>) => Promise<ReturnType<typeof nextCookies>>);
export const headers = nextHeaders as typeof nextHeaders | ((...args: Parameters<typeof nextHeaders>) => Promise<ReturnType<typeof nextHeaders>>);