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

TSCONFIG: Trying to use module import for a directory in React Native using tsconfig paths, but it is not working

$
0
0

I tried to use module imports for a directory in React Native using tsconfig paths, but it gave me this error:

enter image description here

This is how I imported it:

import Router from "@navigation/Router"

VSCode didn't give me any error.

And this is the tsconfig.json:

{"compilerOptions": {"target": "esnext","module": "commonjs","lib": ["es2017"],"allowJs": true,"jsx": "react-native","noEmit": true,"isolatedModules": true,"strict": true,"moduleResolution": "node","baseUrl": ".","paths": {"@navigation/*": ["src/screens/_navigation/*"]    },"allowSyntheticDefaultImports": true,"esModuleInterop": true,"skipLibCheck": false  },"exclude": ["node_modules","babel.config.js","metro.config.js","jest.config.js"  ]}

I found others similar questions but their answers didn't work.

Do someone know why it doesn't work?

Thanks in advance!


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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