Is there a way to use dotenv library as an import (e.g from CDN) only in a HTML script tag or .js file?
I mean without node or npm require or imports.. Otherwise I would have to use something like webpack and I just want to test it quickly on a HTML page…
Short answer: No.
dotenv is a backend tool for getting variables set in a
.env file. If you are using
.env files for public use, that is misusing what the point of environment variables are for. Maybe try just using a
fileame.yml file for public consumption, but
.env files are only used for secret things, like API keys, database passwords, etc.