Skip to content

Commit

Permalink
docs(nextjs): add config for standalone output (#292)
Browse files Browse the repository at this point in the history
Co-authored-by: Julius Marminge <[email protected]>
  • Loading branch information
ezeparziale and juliusmarminge authored Jan 25, 2025
1 parent a854f5c commit 4215dbd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/src/app/docs/nextjs/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,24 @@ export const env = createEnv({

</Callout>

<Callout type="info">

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
```

</Callout>

### 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`:
Expand Down

0 comments on commit 4215dbd

Please sign in to comment.