File tree 1 file changed +17
-1
lines changed
examples/environment-variables/pages
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,22 @@ const IndexPage = () => (
81
81
< pre >
82
82
< code > npm run build && npm run start </ code >
83
83
</ pre >
84
+ < p > Once you run the app, you'll see logs like these in the terminal:</ p >
85
+ < pre >
86
+ < code >
87
+ info - Loaded env from /home/user/../.env.local{ '\n' }
88
+ info - Loaded env from /home/user/../.env.development{ '\n' }
89
+ info - Loaded env from /home/user/../.env{ '\n' }
90
+ </ code >
91
+ </ pre >
92
+ < p >
93
+ The order is important, the first loaded env will have a higher
94
+ priority.
95
+ </ p >
96
+ < p >
97
+ < Code > .env</ Code > will not overwrite any variables defined in{ ' ' }
98
+ < Code > .env.local</ Code > or < Code > .env.development</ Code > .
99
+ </ p >
84
100
</ div >
85
101
</ div >
86
102
)
@@ -92,7 +108,7 @@ export async function getStaticProps() {
92
108
// expose environment variables unless they start with `NEXT_PUBLIC_`
93
109
console . log ( '[Node.js only] ENV_VARIABLE:' , process . env . ENV_VARIABLE )
94
110
console . log (
95
- '[Server only] ENV_LOCAL_VARIABLE:' ,
111
+ '[Node.js only] ENV_LOCAL_VARIABLE:' ,
96
112
process . env . ENV_LOCAL_VARIABLE
97
113
)
98
114
You can’t perform that action at this time.
0 commit comments