-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Issue I decided to rewrite the [with-dotenv](https://github.com/zeit/next.js/tree/canary/examples/with-dotenv) using [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack) example because: - changes doesn't get applied (#4748, brysgo/babel-plugin-inline-dotenv#13) - the production mode doesn't work at all - this approach has already been used in the [examples/relay-modern](https://github.com/zeit/next.js/blob/9320d9f006164f2e997982ce76e80122049ccb3c/examples/with-relay-modern/next.config.js) - it is [documented](https://webpack.js.org/plugins/environment-plugin/#dotenvplugin) by webpack ## Alternatives * remove/deprecate example * fix babel-plugin-inline-dotenv ## Related Closes: #4748
- Loading branch information
1 parent
9018da1
commit d3f1fa6
Showing
5 changed files
with
30 additions
and
28 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require('dotenv').config() | ||
|
||
const path = require('path') | ||
const Dotenv = require('dotenv-webpack') | ||
|
||
module.exports = { | ||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters