From d7b6ec42c241ae40c3f2557b50850218c577b2a0 Mon Sep 17 00:00:00 2001 From: nolostra Date: Wed, 18 Sep 2024 23:57:58 +0530 Subject: [PATCH] fix: added env file checker --- next.config.js | 15 +++++++++++---- package.json | 3 +++ src/components/gmaps-autosuggest.tsx | 2 +- src/env.ts | 25 +++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/env.ts diff --git a/next.config.js b/next.config.js index ae3b9839..dfa34940 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,11 @@ +import { fileURLToPath } from "node:url"; +import createJiti from "jiti"; + +const jiti = createJiti(fileURLToPath(import.meta.url)); + +// Import env here to validate during build. Using jiti we can import .ts files :) +jiti("./src/env"); + /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, @@ -9,12 +17,11 @@ const nextConfig = { images: { remotePatterns: [ { - protocol: 'https', - //Change it with your cdn access domain here - hostname: 'job-board.b-cdn.net', + protocol: "https", + hostname: "job-board.b-cdn.net", // Change this to your CDN domain }, ], }, }; -module.exports = nextConfig; +export default nextConfig; // ES module export \ No newline at end of file diff --git a/package.json b/package.json index b2fbfc69..dad55514 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "100xdevs-job-board", "version": "0.1.0", "private": true, + "type": "module", "scripts": { "dev": "next dev", "build": "next build", @@ -47,6 +48,7 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-toast": "^1.2.1", + "@t3-oss/env-nextjs": "^0.11.1", "@types/lodash": "^4.17.7", "@types/uuid": "^10.0.0", "@uidotdev/usehooks": "^2.4.1", @@ -55,6 +57,7 @@ "clsx": "^2.1.1", "dayjs": "^1.11.13", "framer-motion": "^11.5.4", + "jiti": "^1.21.6", "lodash": "^4.17.21", "lucide-react": "^0.426.0", "next": "14.2.5", diff --git a/src/components/gmaps-autosuggest.tsx b/src/components/gmaps-autosuggest.tsx index a13f04ee..761031c6 100644 --- a/src/components/gmaps-autosuggest.tsx +++ b/src/components/gmaps-autosuggest.tsx @@ -26,7 +26,7 @@ export function GmapsAutocompleteAddress({ form }: { form: any }) { return ( <>