updated webpack config file and removed .env config
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user