通过在Mac上运行的Visual Studio代码启动时,无法将环境变量传递给chrome

问题描述

所以我有一个问题,我试图使用Visual Studio代码来启动和调试基于React的应用程序,但需要传入一个环境变量。但是,我无法从浏览器中的process.env中读取它,它似乎没有传递过来?

我正在macOS Mojave,Chrome 84,VS Code 1.46.1上运行

这是macOS介入并说不的问题还是我做的愚蠢的问题?

我的launch.json在下面...

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more @R_691_4045@ion,visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0","configurations": [
    {
      "type": "chrome","request": "launch","name": "Launch Chrome against localhost","url": "http://localhost:4000/","webroot": "${workspaceFolder}","env": {
        "SERVICE_URL": "http://localhost:4040/"
      }
    }
  ]
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)