瀏覽代碼

load .env only if DEV environment

jojo 5 年之前
父節點
當前提交
3ac33948be
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      webpack.config.js

+ 5 - 2
webpack.config.js

@@ -5,9 +5,12 @@ var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
 // var CopyWebpackPlugin = require('copy-webpack-plugin');
 var { CleanWebpackPlugin } = require('clean-webpack-plugin');
 
-require('dotenv').config({path: __dirname + '/.env'});
+if (process.env.DEV) {
+  console.log('Loading .env variables');
+  require('dotenv').config({path: __dirname + '/.env'});
+}
 
-const JOJOAPPS_SERVER = '149.91.81.94';
+const JOJOAPPS_SERVER = 'localhost';
 const JOJOAPPS_SERVER_PORT = 2610;
 
 // Env variables have effect in app : main.js & socket-service.js & index.html