I'm trying add an env variable to my app without success:
I did
yarn add dotenv
added an .env file in root with
URL='https://mywebsite.com'
added to my app.js:
const dotenv = require("dotenv") dotenv.config() console.log(process.env.URL);
and got undefined
.
In my package.json I have "start": "./.env && react-scripts start",
And I deleted yarn.lock
to get it into effect. Any help will be greatly appreciated