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...
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...
Share Improve this question asked Oct 24, 2020 at 22:49 MarcLMarcL 3,5938 gold badges58 silver badges107 bronze badges1 Answer
Reset to default 6Short 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 filename.json
or fileame.yml
file for public consumption, but .env
files are only used for secret things, like API keys, database passwords, etc.