npm i babel-plugin-module-resolver
this is babel.config.js
module.exports = function (api) { api.cache(true); return { presets: ["babel-preset-expo"], plugins: [ ["module-resolver", { alias: {"@screens": "./src/screens","@components": "./src/components","@services": "./src/services","@infrastructure": "./src/infrastrcuture","@assets": "./assets", }, }, ], ], };};
I thought this set up would be enough but it was not. Then is tsconfig.json:
{"compilerOptions": {"allowSyntheticDefaultImports": true,"jsx": "react-native","lib": ["dom", "esnext"],"moduleResolution": "node","noEmit": true,"skipLibCheck": true,"resolveJsonModule": true,"strict": true, // I added this part"baseUrl": ".","paths": {"@assets": ["./assets/*"],"@*": ["src/*"] } }}
resolver is working for src directories but the issue is with "assets" directory. I keep changing this line "@assets": ["./assets/*"],
"@assets": ["assets/"],"@assets": ["./assets/"],
I could not figure out how to solve the issue.