-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path not recognized when building - Unable to resolve module ... could not be found within the project #396
Comments
Hey there, I think we have a similar problem. After adding the I actually just fixed it just now, I hope there are no other problems Probably similar issue: #387 |
I have this isuues |
to fix it, on RN 0.63.4, I replaced the file babel.config.js by .babelrc, and then in that file :
To do an import :
EDIT : Finally, it seems the only problem I had to make the plugin works, without the need to replace babel.config.js by .babelrc, is to launch the command : Also, the alias can be named without the "@", it will still worked :
Then you can write the import like that : |
Ugh so in our case everything was working for Solution for webdriverio + appium is in your wdio.config.js add the following config to the top level object.
Adding the extensions fixes the file path resolution for the import aliases. |
The plugin configuration that @GrEg00z mentioned worked for me with react-native 0.64.1. Like he mentioned, you can keep your .bable.config.js and make sure you restart the metro cache |
I take it that babel.config.js has to be in the root of the monorepo, right? And the alias paths would be like in the question: './packages/project1/src/components' instead of './src/components'? With this setup i get the same error, no matter how many times I clean the cache. |
@snicro : I do not use a monorepo so I can't tell you if my config will work for you, but yes the babel.config.js is on the root of my project. |
I faced with same issue. The solution is adding extentions like this (not required to change babel.config.js to .babelrc)
|
How is this solved if the |
I'm trying to put together a monorepo project with
react-native
,typescript
and 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 project
I 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 ios
everything works fine as mentioned, but running onlyrun yarn workspace project1 run ios
fails 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.js
file (say add{!@#$: !@#, ...}
) and run./gradlew assemble
nothing 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?
The text was updated successfully, but these errors were encountered: