updated webpack config file and removed .env config
This commit is contained in:
@@ -9,13 +9,9 @@ const prod =
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
// call dotenv and it will return an Object with a parsed key
|
dotenv.config({
|
||||||
const env = dotenv.config().parsed
|
path: './.env',
|
||||||
// reduce env variables to an oject
|
})
|
||||||
const envKeys = Object.keys(env).reduce((prev, next) => {
|
|
||||||
prev[`process.env.${next}`] = JSON.stringify(env[next])
|
|
||||||
return prev
|
|
||||||
}, {})
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entry: './src/index.js',
|
entry: './src/index.js',
|
||||||
@@ -96,7 +92,9 @@ module.exports = () => {
|
|||||||
global: true,
|
global: true,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin(envKeys),
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': JSON.stringify(process.env),
|
||||||
|
}),
|
||||||
new HtmlWebPackPlugin({
|
new HtmlWebPackPlugin({
|
||||||
template: './src/index.html',
|
template: './src/index.html',
|
||||||
filename: './index.html',
|
filename: './index.html',
|
||||||
|
|||||||
Reference in New Issue
Block a user