I'm trying to use typescript path mapping to improve my imports.
Currently I have the following source structure
tsconfig.json
src
..index.ts
..moduleA
....index.ts
So, inside my tsconfig.json I have
"baseUrl": ".",
"paths": {
"moduleA": ["./src/moduleA/index.ts"]
},
and on src\index.js I call
import { MyClassFromModule} from 'moduleA';
Everything compile wells but when React Native tries to load the module I got the following error:
error: bundling: UnableToResolveError: Unable to resolve module `mymodule` from `C:\Git\phoenix\modules-poc\native\build\index.android.js`: Module does not exist in the module map or in these directories: C:\Git\phoenix\modules-poc\native\node_modules
So the things is that the module is not inside node_modules but its inside the source folder. How can I tell React Native to load the module from src folder?
Thanks