2

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.

Problem reported by VSCode

2
  • You mean the webpack environment variables? Have you defined BUILD_ENV in your webpack.config.js? If yes, then try adding "tnsArgs":["--bundle", "--env.BUILD_ENV=local"]. Commented Jan 11, 2019 at 7:24
  • doesn't seem to pick up the value of the variable Commented Jan 14, 2019 at 6:11

1 Answer 1

0

Perhaps this works:

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

or

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

or

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

See platform-specific properties.

Sign up to request clarification or add additional context in comments.

6 Comments

env isn't recognized either. I dont have separate env file. The variable is defined in the package.json
So just typing "env" does that bring up any intellisense for a likely environment variable? I get both of the above options.
I also just found the "osx" option above as well from: stackoverflow.com/questions/29971572/… [upvote the last answer.]
Tried this "osx": { "environment": [ { "name": "BUILD_ENV", "value": "local" }, { "BUILD_ENV": "local" } ] }
this "osx": { "env": [ { "name": "BUILD_ENV", "value": "local" }, { "BUILD_ENV": "local" } ] }
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.