Vuejs - 我可以通过 chrome 检查器访问环境变量吗?

Vuejs - Can I access environment variables through chrome inspector?

是否可以通过 Chrome 检查器访问环境变量?

谢谢

默认情况下,没有环境变量暴露给已编译的客户端应用程序。

但是您可以有选择地手动将变量包含到您的代码中,例如在 HTML 评论或控制台日志输出中。

另见 Vue CLI: Using Env Variables in Client-side Code:

You can access env variables in your application code:

console.log(process.env.VUE_APP_SECRET)

During build, process.env.VUE_APP_SECRET will be replaced by the corresponding value. In the case of VUE_APP_SECRET=secret, it will be replaced by "secret".