Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"
 ],
like image 492
Emon Avatar asked Oct 18 '25 23:10

Emon


1 Answers

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

    "runtimeArgs": [
        "-r",
        "dotenv/config"
    ]
like image 141
dvsoukup Avatar answered Oct 20 '25 13:10

dvsoukup