i have a static project, i am using mapbox i and want to hide the api key from github when i push the code.
i usually use process.env
for that when am working on Reactjs, but here i have this error :
process.env.MAPBOX_API_KEY;
in chrome console.
I created the .env.local and i put the api key inside :
MAPBOX_API_KEY=MAPBOX_API_KEY
After that i added this line in my js file :
mapboxgl.accessToken = process.env.MAPBOX_API_KEY;