My root app directory has a structure consisting of the following folders:
/app/
/environments/
Within the /app/
folder, there is a file named Helper.ts
located in the helpers/
subdirectory:
/app/helper/Helper.ts
Inside this file, I attempted to import content from the environment.prod
file within the /environments/
folder:
import { environment } from "../../environments/environment.prod";
Although the path traverses two directories back, it functions correctly.
However, when the code is compiled, an error message is displayed:
Error: com.tns.NativeScriptException: Failed to find module: "../../environments/environment.prod", relative to: app/helpers/
To address this issue, I have included the following configuration in my tsconfig file:
{ "baseUrl": "./" }