From 8a7c4b7ccf1a2154bfd8d63afb4521c4acff8b4e Mon Sep 17 00:00:00 2001 From: zramsay Date: Wed, 5 Feb 2025 17:29:48 -0500 Subject: [PATCH] another config --- next.config.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/next.config.js b/next.config.js index 8c02155..4b6798d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,23 +1,22 @@ -// next.config.js -const webpack = require('webpack') const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true' }) -const envMap = Object.keys(process.env) - .filter(key => key.startsWith('CERC_')) - .reduce((acc, key) => { - acc[`process.env.${key}`] = JSON.stringify(process.env[key]) - return acc - }, {}) - +/** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: false, swcMinify: true, webpack: (config) => { - config.plugins.push(new webpack.DefinePlugin(envMap)) + // Let the build script handle the DefinePlugin injection + // The script will add the envMap DefinePlugin automatically return config } } -module.exports = withBundleAnalyzer(nextConfig) +if (process.env.NODE_ENV === 'production') { + // Let the build script transform this + const __orig_cfg__ = withBundleAnalyzer(nextConfig) +} else { + // For development, export directly + module.exports = withBundleAnalyzer(nextConfig) +}