0

I have multiple Angular 9 environment.ts files that contain url´s for different servers that I am developing for e.g. prod, staging, dev, localhost. When I hit F5 the default environment.ts file is used which contains the localhost urls.

I want to be able to debug against my dev and staging servers, even prod when I hit F5. Is there an easy way to change which file is used when I hit F5 debug mode in VSCode?

Here is the launch.json file:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:4200",
            "webRoot": "${workspaceFolder}",
        }
    ]
}
4
  • 1
    Could you please share your launch.json configuration? Commented Mar 9, 2020 at 15:53
  • Hi @Guillaume just added the file Commented Mar 9, 2020 at 16:14
  • Do you use ng serve to build and serve your app in dev mode ? Commented Mar 9, 2020 at 16:42
  • Hi @ThierryFalvo yes I am using ng serve Commented Mar 9, 2020 at 17:01

1 Answer 1

1

You should switch between your different environment files, with for example for your staging environment :

  ng serve --configuration staging
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.