diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2020-05-15 17:50:36 -0700 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2020-05-15 17:50:36 -0700 |
commit | 55d76fc76d19cac3e36f73dca983723273820193 (patch) | |
tree | ebd1e878a24d011ae70389dfc1b99e654677e124 /webpack.config.js | |
parent | 98c7540fff67c232c1b04f2130ee624f9a70afbd (diff) |
env fixes?
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 13 |
1 files changed, 8 insertions, 5 deletions
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', |