Skip to content

Instantly share code, notes, and snippets.

@abedzantout
Created September 20, 2019 20:30
Show Gist options
  • Save abedzantout/a958a98caa5f1f96109dc6894ca3fe58 to your computer and use it in GitHub Desktop.
Save abedzantout/a958a98caa5f1f96109dc6894ca3fe58 to your computer and use it in GitHub Desktop.
Allowing next to read from our .env file
const path = require('path');
const Dotenv = require('dotenv-webpack');
const next_config = {
webpack: config => {
config.plugins = config.plugins || [];
config.plugins = [
...config.plugins,
// Read the .env file
new Dotenv({
path: path.join(__dirname, '.env'),
systemvars: true
})
];
return config;
},
}
module.exports = {...next_config};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment