diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-05-14 16:33:44 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-05-14 16:33:44 -0400 |
commit | b9440e34d89b28acacdd6eed2cda39cd2a1d8c46 (patch) | |
tree | 9d7c91a4f6ebf7270bbc66180cadbb592dac40a7 /webpack.config.js | |
parent | f6a55c0d613787f60e4a40b728a1acbc6c39c552 (diff) | |
parent | e31ec0a7d4fe9772f1e52081717e53e0fdf9fb9b (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/webpack.config.js b/webpack.config.js index 6265883fd..67d492e1f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -16,22 +16,21 @@ const plugins = [ new webpack.HotModuleReplacementPlugin(), ]; -const dotenv = require('dotenv'); - -function transferEnvironmentVariables() { +(function transferEnvironmentVariables() { const prefix = "_CLIENT_"; - const env = dotenv.config().parsed; - if (env) { - plugins.push(new webpack.DefinePlugin(Object.keys(env).reduce((mapping, envKey) => { - if (envKey.startsWith(prefix)) { - mapping[`process.env.${envKey.replace(prefix, "")}`] = JSON.stringify(env[envKey]); - } - return mapping; - }, {}))); + const { + parsed + } = require('dotenv').config(); + if (!parsed) { + return; } -} - -transferEnvironmentVariables(); + plugins.push(new webpack.DefinePlugin(Object.keys(parsed).reduce((mapping, envKey) => { + if (envKey.startsWith(prefix)) { + mapping[`process.env.${envKey.replace(prefix, "")}`] = JSON.stringify(parsed[envKey]); + } + return mapping; + }, {}))); +})(); module.exports = { mode: 'development', |