Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Typescript resolving .ts instead of dirname/index.ts file

$
0
0

I have setup react native project using nx https://nx.dev/p/n/react-native/application

Now I am getting error.

Error: ENOENT: no such file or directory, lstat '***/apps/mobile/src/app/config.ts'

My Dir structure is like below

- apps  - mobile    - src      - app        - config          - index.ts      - main.tsx

I have imported config in main.tsx like below

import { BaseSetting } from "@apps/mobile/src/app/config";

I have checked in root tsconfig.json there are already added "moduleResolution": "node".


I am surprise when I am using imports like import { BaseSetting } from "./app/config"; then it's resolving correctly, So, I think issue in resolve tsconfig.json paths.

below is my tsconfig.json

{"compileOnSave": false,"compilerOptions": {"rootDir": ".","sourceMap": true,"declaration": false,"moduleResolution": "node","emitDecoratorMetadata": true,"experimentalDecorators": true,"importHelpers": true,"target": "es2015","module": "esnext","lib": ["es2017", "dom"],"skipLibCheck": true,"skipDefaultLibCheck": true,"baseUrl": ".","paths": {"@apps/*": ["apps/*"],"@in-dep/shared": ["libs/shared/src/index.ts"],"@in-dep/types": ["libs/types/src/index.ts"]    }  },"exclude": ["node_modules", "tmp"]}

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>