[英]Can I use .dotenv library as HTML script imports only without npm or node.js?
Is there a way to use dotenv library as an import (eg from CDN) only in a HTML script tag or .js file?有没有办法只在 HTML 脚本标签或 .js 文件中使用 dotenv 库作为导入(例如从 CDN)? 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...我的意思是没有 node 或 npm require 或 import .. 否则我将不得不使用 webpack 之类的东西,我只想在 HTML 页面上快速测试它......
Short answer: No.简短的回答:没有。
dotenv
is a backend tool for getting variables set in a .env
file. dotenv
是一个后端工具,用于获取.env
文件中设置的变量。 If you are using .env
files for public use, that is misusing what the point of environment variables are for.如果您将.env
文件用于公共用途,那就是滥用环境变量的意义所在。 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.也许尝试只使用filename.json
或fileame.yml
文件供公众使用,但.env
文件仅用于机密内容,例如 API 密钥、数据库密码等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.