developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8.07k stars 363 forks source link

Environment variables #1055

Closed artooras closed 1 year ago

artooras commented 1 year ago

Hi. This may be a silly question, but why doesn't microbundle resolve process.env.MY_VAR that I place in my .env.local file during the build process? In the build files it remains as process.env.MY_VAR.

rschristian commented 1 year ago

It's not replaced as we do not read any of your .env files. Instead, check out the docs for the --define flag: https://github.com/developit/microbundle#defining-build-time-constants

artooras commented 1 year ago

I see, thanks for the pointer @rschristian!

rschristian commented 1 year ago

Going to close this out, nothing actionable for Microbundle. Feel free to respond if you have any further questions though