From e2bf79a13ddbc5cc3aaa5ea3c0d433288d296a1c Mon Sep 17 00:00:00 2001 From: dmuser Date: Mon, 4 Aug 2025 12:45:18 -0700 Subject: [PATCH] Debug ENV on prod2 --- craco.config.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/craco.config.js b/craco.config.js index ab18d3c..5d51b69 100644 --- a/craco.config.js +++ b/craco.config.js @@ -15,7 +15,18 @@ module.exports = { { plugin: { overrideWebpackConfig: ({ webpackConfig }) => { - const envPath = path.resolve(__dirname, "../client_env/.env"); + // Check for environment variable first + let envPath = process.env.ENV_FILE_PATH; + + // If not set, try relative path (for local development) + if (!envPath) { + envPath = path.resolve(__dirname, "../client_env/.env"); + } + + // If relative path doesn't exist, try absolute path (for server) + + console.log("Loading environment variables from:", envPath); + webpackConfig.plugins.forEach((plugin) => { if (plugin.constructor.name === "DefinePlugin") { const dotenv = require("dotenv").config({ path: envPath });