fix: support multi env

This commit is contained in:
Mythie
2023-10-18 23:19:29 +11:00
parent 5445b85aae
commit 2ac0d79051
2 changed files with 12 additions and 4 deletions

View File

@ -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} */