updated webpack config file and removed .env config

This commit is contained in:
andres alcocer
2022-11-24 15:24:37 -05:00
parent b8105a9c29
commit d7db85c1ae

View File

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