From d7db85c1aefbe0b5336414cd0bb270cc6955c493 Mon Sep 17 00:00:00 2001 From: andres alcocer Date: Thu, 24 Nov 2022 15:24:37 -0500 Subject: [PATCH] updated webpack config file and removed .env config --- webpack.config.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index c3e6898..d2b753b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,13 +9,9 @@ const prod = const path = require('path') module.exports = () => { - // call dotenv and it will return an Object with a parsed key - const env = dotenv.config().parsed - // reduce env variables to an oject - const envKeys = Object.keys(env).reduce((prev, next) => { - prev[`process.env.${next}`] = JSON.stringify(env[next]) - return prev - }, {}) + dotenv.config({ + path: './.env', + }) return { entry: './src/index.js', @@ -96,7 +92,9 @@ module.exports = () => { global: true, }, plugins: [ - new webpack.DefinePlugin(envKeys), + new webpack.DefinePlugin({ + 'process.env': JSON.stringify(process.env), + }), new HtmlWebPackPlugin({ template: './src/index.html', filename: './index.html',