From 8edc1434f15c6ce52a789c151fe028bce975afc1 Mon Sep 17 00:00:00 2001 From: Ezequiel Parziale Date: Fri, 13 Dec 2024 22:06:32 -0300 Subject: [PATCH] docs(nextjs): add config for standalone output --- docs/src/app/docs/nextjs/page.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/src/app/docs/nextjs/page.mdx b/docs/src/app/docs/nextjs/page.mdx index 0cbbe710..ca9e0977 100644 --- a/docs/src/app/docs/nextjs/page.mdx +++ b/docs/src/app/docs/nextjs/page.mdx @@ -105,6 +105,24 @@ export const env = createEnv({ + + +If you're using the `standalone` output in your `next.config.ts`, make sure to include the following: + +```ts title="next.config.ts" +import type { NextConfig } from "next" + +const nextConfig: NextConfig = { + output: "standalone", + // Add the packages in transpilePackages + transpilePackages: ["@t3-oss/env-nextjs", "@t3-oss/env-core"], +} + +export default nextConfig +``` + + + ### Validate schema on build (recommended) We recommend you importing your newly created file in your `next.config.js`. This will make sure your environment variables are validated at build time which will save you a lot of time and headaches down the road. You can use [unjs/jiti](https://github.com/unjs/jiti) to import TypeScript files in your `next.config.js`: