简体   繁体   中英

Set environment variable in Visual Studio Code debugger on a Mac

I want to use the VSCode debugger and want to set the environment variables before launching the app. The configuration in the Launch folder looks something like this.

    {
        "name": "Launch on iOS",
        "type": "nativescript",
        "request": "launch",
        "platform": "ios",
        "appRoot": "${workspaceRoot}",
        "sourceMaps": true,
        "watch": true,
        "environment": [
            {
                "BUILD_ENV": "local"
            }
        ]
    }

This doesn't seem to work though. I am using a Mac.

VSCode报告的问题

Perhaps this works:

"env": {
  "BUILD_ENV": "local"
} 

or

"envFile": "${workspaceFolder}/.env",

or

"osx": {
    "environment": [
       {  "name": "", 
          "value": ""
      }
   ]
},

See platform-specific properties .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM