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

react native ts imports aliases

$
0
0

I try to use aliases in ma react-native ts project but my aliases doesn't work...

Here is my babel.config.js:

 presets: ['module:metro-react-native-babel-preset'],  plugins: ['react-native-reanimated/plugin',    ['module:react-native-dotenv',      {        moduleName: '@env',        path: '.env',        safe: true,      },    ],    ['module-resolver',      {        root: ['./'],        extensions: ['.ios.ts', '.android.ts', '.ts', '.ios.tsx', '.android.tsx', '.tsx', '.jsx', '.js', '.json'],        alias: {'@': 'src/*','@components': './src/components','@api': './src/api','@languages': './src/languages','@navigation': './src/navigation','@screens': './src/screens','@styles': './src/styles','@stores': './src/stores','@utils': './src/utils','@types': ['./src/types'],        },      },    ],  ],

and my ts.config:

"baseUrl": ".","paths": {"@*": ["./src/*"],"@components/*": ["./src/components/*"],"@api/*": ["./src/api/*"],"@languages/*": ["./src/languages/*"],"@navigation/*": ["./src/navigation/*"],"@screens/*": ["./src/screens/*"],"@styles/*": ["src/styles/*"],"@stores/*": ["./src/stores/*"],"@utils/*": ["./src/utils/*"],"@types/*": ["./src/types/*"]    } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,    // "rootDirs": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */"typeRoots": ["./src/types"] /* List of folders to include type definitions from. ...."exclude": ["node_modules"],

with this configuration, my aliases are not recognized and I tried to restart metro etc etc
Any idea?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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