1

I have a root app directory with the following folders:

/app/
/environments/

Inside /app/ exist helpers/Helper.ts:

/app/helper/Helper.ts

In this file I tried to import environments:

import { environment } from "../../environments/environment.prod";

Two directories back, it is right, it works.

Problem is when compiler compiles code it says:

Error: com.tns.NativeScriptException: Failed to find module: "../../environments/environment.prod", relative to: app/helpers/

So, my tsconfig contains:

   { "baseUrl": "./" }
Alex Myers
  • 6,196
  • 7
  • 23
  • 39
POV
  • 11,293
  • 34
  • 107
  • 201

1 Answers1

1

usually it does work well.

What I suggest is to use "paths" in your tsconfig

"paths": {
      "@env": [
        "environments/*"
      ],
    }

in your code

import { environment } from "@env/environment.prod";
Alexander_F
  • 2,831
  • 3
  • 28
  • 61