-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Modules resolution does not support relative paths #13448
Comments
I think there is a way to tell your project that the default folder name is import something from 'MyProjectName/file-in-the-parent-directory' I think it's auto defined when you init your project with a given name Do you have webpack in your project ? It look like this in your webpack config resolve: {
...
alias: {
shared: __dirname + '/../src/app/shared',
src: __dirname + '/../src',
app: __dirname + '/../src/app',
},
...
}, |
react-native uses packager so the webpack configuration has no effect on my project at least for the RN part Let's say my folder structure looks like this:
I can easily use the webpack react-native start --projectRoots `pwd`,`pwd`/../shared/node_modules,`pwd`/../shared` but other weird issues get thrown making no sense for example: I don't see any reasonable rock solid solution here for something that was built with the primary goal of sharing components between web apps and native apps. I hope someone could spread some light on this topic thanks. |
I have the same issue with sharing code between web & native apps. I hope there will be a better way to do it. |
I thinks there is no easy fix to this issue since RN uses its own package manager to handle npm dependencies. I will close this issue because there was no useful answer since 1 month and I had to hack stuff all around to let my RN app properly working in a shared web environment (along with other issues not related to the one above). I could only recommend to whoever comes to this issue that if you have enough time and budget for your project prefer always a native approach over an hybrid solution: you can spend much less time and resources building a shared restful server (serving graphql queries or simply json responses) than trying to let your app logic working in 2 different environments without having the either the possibility to share the same node dependencies. |
Description
The modules resolution does not support relative paths out of the project root
Reproduction Steps and Sample Code
In any of
index.ios.js
orindex.android.js
Solution
I have spent hours using symlinks,
npm link
, changing the project root viacli.config.js
projectRoots
and last but not leastbabel-plugin-module-resolver
but none of these solutions seems to work properly fine for such a trivial behaviorAdditional Information
The text was updated successfully, but these errors were encountered: