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',