Emon
Emon

Reputation: 831

VSCode - Launch.json specify arguments

I am using the dotenv package to inject environment variables to my OS which I can specify by calling the following:

node -r dotenv/config dist/app.js

How can I run the same command from launch.json? Currently I have the following but it doesn't load the dotenv package

"program": "${workspaceFolder}\\dist\\app.js",
"args": [
   "-r dotenv/config"
 ],

Upvotes: 3

Views: 4129

Answers (1)

dvsoukup
dvsoukup

Reputation: 1596

Try using this as one of the keys instead of args:

    "runtimeArgs": [
        "-r",
        "dotenv/config"
    ]

Upvotes: 7

Related Questions