diff --git a/apps/marketing/next.config.js b/apps/marketing/next.config.js index c9193ed77..e8d7b2d89 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.local'), +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 cb05de902..00f2368c5 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.local'), +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} */