Browse Source

Merge pull request #1393 from porter-dev/fix/local-env

[FIX] Allow webpack to get environment variables from process
jusrhee 4 years ago
parent
commit
625c71df94
1 changed files with 4 additions and 1 deletions
  1. 4 1
      dashboard/webpack.config.js

+ 4 - 1
dashboard/webpack.config.js

@@ -11,7 +11,10 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
 const TerserPlugin = require("terser-webpack-plugin");
 
 module.exports = () => {
-  const env = dotenv.config().parsed;
+  let env = dotenv.config().parsed;
+  if (!env) {
+    env = process.env;
+  }
   const envKeys = Object.keys(env).reduce((prev, next) => {
     prev[`process.env.${next}`] = JSON.stringify(env[next]);
     return prev;