panzerdp / dmitripavlutin.com-comments

7 stars 0 forks source link

environment-variables-javascript/ #160

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Environment Variables in JavaScript: process.env

How to access environment variables in JavaScript using process.env and expose them to the browser runtime using bundlers like Vite and webpack.

https://dmitripavlutin.com/environment-variables-javascript/

EvgenyWas commented 1 year ago

Hello Dmitri,

Thank you for the article and the useful material! I don't know if this is significant, but it may be worth mentioning that the names of env variables in Vite are starting with VITE_ prefix only by default. We're able to set our own name. https://vitejs.dev/config/shared-options.html#envprefix

Thanks for your work!

panzerdp commented 1 year ago

worth mentioning that the names of env variables in Vite are starting with VITE_ prefix only by default

Thanks for the idea @EvgenyWas.

viinasu commented 1 year ago

Short and sweet, love the demo as well! Thanks!