4

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"
 ],

1 Answer 1

8

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

    "runtimeArgs": [
        "-r",
        "dotenv/config"
    ]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.