From 55d76fc76d19cac3e36f73dca983723273820193 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Fri, 15 May 2020 17:50:36 -0700 Subject: env fixes? --- webpack.config.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 67d492e1f..1351008ea 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -16,7 +16,7 @@ const plugins = [ new webpack.HotModuleReplacementPlugin(), ]; -(function transferEnvironmentVariables() { +function transferEnvironmentVariables() { const prefix = "_CLIENT_"; const { parsed @@ -24,13 +24,16 @@ const plugins = [ if (!parsed) { return; } - plugins.push(new webpack.DefinePlugin(Object.keys(parsed).reduce((mapping, envKey) => { + const resolvedClientSide = Object.keys(parsed).reduce((mapping, envKey) => { if (envKey.startsWith(prefix)) { - mapping[`process.env.${envKey.replace(prefix, "")}`] = JSON.stringify(parsed[envKey]); + mapping[`process.env.${envKey.replace(prefix, "")}`] = parsed[envKey]; } return mapping; - }, {}))); -})(); + }, {}); + plugins.push(new webpack.DefinePlugin(resolvedClientSide)); +} + +transferEnvironmentVariables(); module.exports = { mode: 'development', -- cgit v1.2.3-70-g09d2 From 28985a26b4f852dffeb02a43d135776314a1f600 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Fri, 15 May 2020 17:58:30 -0700 Subject: undoing env fixes lol --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index 1351008ea..737882fe2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -26,7 +26,7 @@ function transferEnvironmentVariables() { } const resolvedClientSide = Object.keys(parsed).reduce((mapping, envKey) => { if (envKey.startsWith(prefix)) { - mapping[`process.env.${envKey.replace(prefix, "")}`] = parsed[envKey]; + mapping[`process.env.${envKey.replace(prefix, "")}`] = JSON.stringify(parsed[envKey]); } return mapping; }, {}); -- cgit v1.2.3-70-g09d2