How do I add environment variables to launch.json in VSCode

前端 未结 10 793
囚心锁ツ
囚心锁ツ 2020-12-08 01:29

Working with the new VSCode editor on a node.js project. I am attempting to configure my \"Launch\" profile for debugging by editing the launch.json file. I need to setup a

10条回答
  •  北海茫月
    2020-12-08 02:19

    I'm successfully passing them using the env property in launch.json:

    {
      "version": "0.2.0",
      "configurations": [
        {
        "type": "node",
        "request": "launch",
        "name": "SLS Webpack",
        "protocol": "legacy",
        "program": "${workspaceRoot}/node_modules/.bin/sls",
        "cwd": "${workspaceRoot}",
        "args": ["webpack", "watch", "-f", "${fileBasenameNoExtension}", "-p", "${fileDirname}/event.json"],
        "env": {"AWS_REGION":"us-east-1", "SLS_DEBUG":"*"},
        "outFiles": ["${cwd}/dist/**/*.js"],
        "sourceMaps": true,
        "smartStep": true    
        }
      ]
    }
    

提交回复
热议问题