Skip to content

Commit

Permalink
fix(webpack.config.js): better process.env support
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Jan 10, 2021
1 parent 2f0de26 commit 25db498
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ debug('got env => %O', env);
verifyEnvironment();

const plugins = [
// ? Load our .env results as the defaults
new EnvironmentPlugin(env),
// ? Create a shim for process.env (sorry but I like using it everywhere!)
new DefinePlugin({
...(process.env.DEBUG ? { 'process.env.DEBUG': `"${process.env.DEBUG}"` } : {}),
'process.env': '{}'
})
// ? Load our .env results as the defaults (overridden by process.env)
new EnvironmentPlugin({ ...env, ...process.env }),
// ? Create shim for process.env (per my tastes!)
new DefinePlugin({ 'process.env': '{}' })
];

module.exports = {
Expand Down

0 comments on commit 25db498

Please sign in to comment.