miniperplx/next.config.mjs
simplr-sh 186bd3c2cc Refactor environment variable handling and improve API key management
- Introduced `client.ts` and `server.ts` for structured environment variable management using `@t3-oss/env-nextjs`.
- Updated references to environment variables in various files to use the new `clientEnv` and `serverEnv` objects.
- Enhanced the `next.config.mjs` file to validate environment variables during build.
- Added new dependencies: `@t3-oss/env-nextjs` and `jiti` for improved environment handling.
- Cleaned up imports and ensured consistent usage of environment variables across the application.
2025-01-06 10:28:54 +05:30

95 lines
2.1 KiB
JavaScript

// https://env.t3.gg/docs/nextjs#validate-schema-on-build-(recommended)
import { createJiti } from 'jiti'
import { fileURLToPath } from 'node:url'
const jiti = createJiti(fileURLToPath(import.meta.url))
// Import env here to validate during build. Using jiti we can import .ts files :)
jiti.import('./env/server')
jiti.import('./env/client')
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['geist'],
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
],
},
]
},
images: {
dangerouslyAllowSVG: true,
remotePatterns: [
{
protocol: 'https',
hostname: 'www.google.com',
port: '',
pathname: '/s2/favicons',
},
{
protocol: 'https',
hostname: 'api.producthunt.com',
port: '',
pathname: '/widgets/embed-image/v1/featured.svg',
},
{
protocol: 'https',
hostname: 'metwm7frkvew6tn1.public.blob.vercel-storage.com',
port: '',
pathname: '**',
},
// upload.wikimedia.org
{
protocol: 'https',
hostname: 'upload.wikimedia.org',
port: '',
pathname: '**',
},
// media.theresanaiforthat.com
{
protocol: 'https',
hostname: 'media.theresanaiforthat.com',
port: '',
pathname: '**',
},
// www.uneed.best
{
protocol: 'https',
hostname: 'www.uneed.best',
port: '',
pathname: '**',
},
// image.tmdb.org
{
protocol: 'https',
hostname: 'image.tmdb.org',
port: '',
pathname: '/t/p/original/**',
},
// image.tmdb.org
{
protocol: 'https',
hostname: 'image.tmdb.org',
port: '',
pathname: '/**',
},
],
},
}
export default nextConfig