how to use env.js file in next.config.js file to read the variables #11252
Unanswered
kaleshasheik
asked this question in
Help
Replies: 1 comment
-
There's an open RFC to add |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi ,
I have created a file env.js with variable eg: API_URL = "https://apiurl.com"
In next.config.js, I have used as
require('dotenv').config()
const path = require('path')
const Dotenv = require('dotenv-webpack')
webpack(config) {
config.plugins = [
...config.plugins,
new Dotenv({
path: path.join(__dirname, 'env.js')
}
});
After that,
when i do console, its not printing the variables defined in env.js
console.log(process.env)
Can someone help on this ?
Beta Was this translation helpful? Give feedback.
All reactions