Skip to content
This repository was archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
nenadV91 committed Sep 21, 2021
1 parent e2a17b6 commit ed3425b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
13 changes: 0 additions & 13 deletions getWebpackConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const assert = require('assert').strict
const path = require('path')
const dotenv = require('dotenv')
const { version } = require('./package.json')

const webpack = require('webpack')
Expand Down Expand Up @@ -88,22 +87,10 @@ function _getPlugins({ apps, config, envVars, stats, defineVars, publicPaths, is
// Fork ts checker plugin: Speed up TS and lint checks
plugins.push(new ForkTsCheckerWebpackPlugin({ silent: stats }))

// call dotenv and it will return an Object with a parsed key
const env = dotenv.config().parsed

console.log('ENV', env)

// reduce it to a nice object, the same as before
const envKeys = Object.keys(env).reduce((prev, next) => {
prev[`process.env.${next}`] = JSON.stringify(env[next])
return prev
}, {})

// Define Plugin: Create global constants
plugins.push(
new webpack.DefinePlugin({
VERSION: JSON.stringify(require('./package.json').version),
...envKeys,
...defineVars,
}),
)
Expand Down
4 changes: 3 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const dotenv = require('dotenv')

// Setup env vars
dotenv.config()
const envVars = dotenv.config()

console.log('ENV VARS RANDOM', envVars)

const getWebpackConfig = require('./getWebpackConfig')
const loadConfig = require('./src/loadConfig')
Expand Down

0 comments on commit ed3425b

Please sign in to comment.