Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b43af823
Commit
b43af823
authored
Mar 31, 2018
by
Luis Fernando Alvarez D
Committed by
Tim Neutkens
Mar 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated example with-now-env (#4081)
* New example: with-now-env * updated the example with-now-env
parent
7e671522
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
next.config.js
examples/with-now-env/next.config.js
+8
-6
No files found.
examples/with-now-env/next.config.js
View file @
b43af823
const
webpack
=
require
(
'webpack'
)
/**
* After the next require you can use process.env to get your secrets
*/
...
...
@@ -16,12 +17,13 @@ console.log({
*/
module
.
exports
=
{
webpack
:
config
=>
{
config
.
plugins
.
forEach
(
plugin
=>
{
if
(
plugin
.
constructor
.
name
===
'DefinePlugin'
)
{
plugin
.
definitions
[
'process.env.SECRET'
]
=
JSON
.
stringify
(
process
.
env
.
SECRET
)
}
})
config
.
plugins
.
push
(
new
webpack
.
DefinePlugin
({
'process.env.SECRET'
:
JSON
.
stringify
(
process
.
env
.
SECRET
)
})
// Same as above
// new webpack.EnvironmentPlugin(['SECRET'])
)
return
config
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment