Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down