diff --git a/apps/marketing/next.config.js b/apps/marketing/next.config.js index e832dbd7c..a997e7b55 100644 --- a/apps/marketing/next.config.js +++ b/apps/marketing/next.config.js @@ -2,8 +2,12 @@ const path = require('path'); const { withContentlayer } = require('next-contentlayer'); -require('dotenv').config({ - path: path.join(__dirname, '../../.env'), +const ENV_FILES = ['.env', '.env.local', `.env.${process.env.NODE_ENV || 'development'}`]; + +ENV_FILES.forEach((file) => { + require('dotenv').config({ + path: path.join(__dirname, `../../${file}`), + }); }); /** @type {import('next').NextConfig} */ diff --git a/apps/web/next.config.js b/apps/web/next.config.js index a4e386fd0..7d1c0811c 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -2,8 +2,12 @@ const path = require('path'); const { version } = require('./package.json'); -require('dotenv').config({ - path: path.join(__dirname, '../../.env'), +const ENV_FILES = ['.env', '.env.local', `.env.${process.env.NODE_ENV || 'development'}`]; + +ENV_FILES.forEach((file) => { + require('dotenv').config({ + path: path.join(__dirname, `../../${file}`), + }); }); /** @type {import('next').NextConfig} */