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

Can't setup path alias typescript React Native

$
0
0

I trying to setup my path alias in React Native. I added needed paths into tsconfig and babel.config:

tsconfig:

{"extends": "expo/tsconfig.base","compilerOptions": {"strict": true,"jsx": "react-native","target": "ESNext","allowSyntheticDefaultImports": true,"skipLibCheck": true,"baseUrl": ".","paths": {"@app/*": ["src/*"],"@assets/*": ["assets/*"],    }  }}

and babel.config:

module.exports = function (api) {  api.cache(true);  return {    presets: ['babel-preset-expo'],    plugins: [      ['module-resolver',        {          extensions: ['.tsx', '.ts', '.js', '.json'],          root: '.',          alias: {'@app': './src','@assets': './assets',          },        },      ],    ],  };};

But it trying to resolve my paths such way: Unable to resolve "./src/*/hooks/useAppFonts" from "App.tsx".

What have I done wrong?


Viewing all articles
Browse latest Browse all 6295

Trending Articles



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