From 5007fc6c008975d7d3249dc1ed4f3fef955da9d1 Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:23:15 +0200 Subject: [PATCH] try with env setting alternative --- frontend/frontend/craco.config.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/frontend/frontend/craco.config.js b/frontend/frontend/craco.config.js index e1d369d5..2bc98b9c 100644 --- a/frontend/frontend/craco.config.js +++ b/frontend/frontend/craco.config.js @@ -22,16 +22,14 @@ module.exports = { net: false, }; - // Turn { KEY: "value" } into { "process.env.KEY": JSON.stringify("value") } - const env = { - myDummyKey: 'myDummyPAT', - }; - const envKeys = Object.keys(env).reduce((prev, next) => { - prev[`process.env.${next}`] = JSON.stringify(env[next]); - return prev; - }, {}); - webpackConfig.plugins.push(new webpack.DefinePlugin(envKeys)); - + // Inject process.env so server code can access PAT_1 + webpackConfig.plugins.push( + new webpack.DefinePlugin({ + 'process.env': { + myDummyKey: JSON.stringify('myDummyPAT'), // <-- your env var + }, + }), + ); return webpackConfig; }, },