Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Created April 25, 2018 12:55
Show Gist options
  • Save gladchinda/66ab6463d018d133ef794b0b665c81f2 to your computer and use it in GitHub Desktop.
Save gladchinda/66ab6463d018d133ef794b0b665c81f2 to your computer and use it in GitHub Desktop.
const webpack = require('webpack');
require('dotenv').config();
module.exports = {
webpack: config => {
const env = Object.keys(process.env).reduce((acc, curr) => {
acc[`process.env.${curr}`] = JSON.stringify(process.env[curr]);
return acc;
}, {});
config.plugins.push(new webpack.DefinePlugin(env));
return config;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment