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

babel-plugin-module-resolver doesn't work with react native and typescript

$
0
0

I've been trying to implement module-resolver to my react native app but vs code underlines red the import lines

tsconfig.json file

{"compilerOptions": {"allowSyntheticDefaultImports": true,"jsx": "react-native","lib": ["dom", "esnext"],"moduleResolution": "node","noEmit": true,"skipLibCheck": true,"resolveJsonModule": true,"strict": true,"baseUrl": ".","paths": {"@utils/*": ["./src/utils/*"],"@components/*": ["./src/components/*"],"@constants/*": ["./src/constants/*"],"@data/*": ["./src/data/*"],"@hooks/*": ["./src/hooks/*"],"@redux/*:": ["./src/redux/*"],"@screens/*": ["./src/screens/*"],"@services/*": ["./src/services/*"],"@types/*": ["./src/types/*"]    }  }}

babel.config.js file

 ["module-resolver",            {              root: ["."],              extensions: [".ios.ts",".android.ts",".ts",".ios.tsx",".android.tsx",".tsx",".jsx",".js",".json",              ],              alias: {"@assets": "./assets","@components": "./src/components","@constants": "./src/constants","@data": "./src/data","@hooks": "./src/hooks","@redux": "./src/redux","@screens": "./src/screens","@services": "./src/services","@types": "./src/types","@utils": "./src/utils",              },            },          ],

My folder structure is like below

enter image description here

Error is like this

enter image description here

Code is working but how can I fix the editor error?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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