module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
root: ['./packages/project1/src/'],
extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
alias: {
'@': './packages/project1/src',
'@screen': './packages/project1/src/screen',
'@util': './packages/project1/src/util/*',
'@nav': './packages/project1/src/navigation/*',
'@component': './packages/project1/src/component/*',
},
},
],
'babel-plugin-styled-components',
],
};
I'm trying to put together a monorepo project with
react-native,typescriptand get relative imports working and keep getting the following error:Unable to resolve module `@screen/XXX` from `packages/project1/src/...`: @screen/XXX could not be found within the projectI noticed #276 sounds similar to what I'm experiencing, but I don't have any env related configuration and I can reproduce it even in the debug environment.
First, my mono repo structure is:
I managed to get it all working on development environment, but have some weird behaviours happening:
yarn workspace project1 run start//yarn workspace project1 run ioseverything works fine as mentioned, but running onlyrun yarn workspace project1 run iosfails to load the path giving the error above (likely because the packager is started from Xcode with a different working directory?)./gradlew assemble... from the android folder, it also gives the same error above.babel.config.jsfile (say add{!@#$: !@#, ...}) and run./gradlew assemblenothing seems to changebabel.config.js
Resolver version: "babel-plugin-module-resolver": "^4.0.0",
Any ideas on what might have been happening or what am I missing?