try with env setting alternative

This commit is contained in:
martin-mfg
2025-10-08 16:23:15 +02:00
parent f09b19af94
commit 5007fc6c00
+8 -10
View File
@@ -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;
},
},