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
TypeORM pulls Native Modules on Browser import when using Metro #6839
Comments
If this is with expo can it be replicated as a snack |
Probably, but I am ejected/using the Native/Bare Flow. I was able to reproduce with this repo as a very bare-bones example: https://github.com/vinipachecov/react-native-typeorm-example |
Ok- I'll try pulling that down and taking a look. In the meantime, have you tried this metro option https://facebook.github.io/metro/docs/configuration/#resolvermainfields |
I have not, the Metro config above is what I currently use. I do see there are various redirections in the package.json for TypeORM, but they are not being applied (based on what I saw in the above error message, the wrong PlatformTools is pulled) Maybe Also what about the babel config? I adjusted it (as well as metro) according to the TypeORM react-native example repo. |
I think the babel config is fine either way - the published version of typeorm should not need much from babel as it's plain JS to a pretty old JS version. The metro l change should apply to both node modules as well as your package. This should allow you to import "typeorm" directly (not the browser subdirectory) but I've not tried it yet. I'll be looking at this a bit later today depending on my network connectivity. Automating packages anr testing for some if these more exotic environments is on the to-do list but we just haven't gotten to it yet. |
I made sure that all of my imports are definitely from the browser subpackage (that second repo also confirms it) & it's not a huge inconvenience to me to use the browser submodule so no worries there. Like I said, something about the specific PlatformTools used is probably affecting this since (afaik) Metro doesn't do dead-code elimination/tree-shaking. Thanks |
Right - but those changes will pull in not just the items from that browser sub-package but the overrides for various things under the browser subpackage automatically. EG, replacing the browsertools. |
Not blaming you or anyone on this - but what a flipping nightmare to get react-native set up for android! I ended up giving up and setting up android studio to manage all of it for me. I was so very spoiled by using expo. 😆 I packaged the I could not replicate the issues you had - but there were two things I did that could help you: I replaced all references to I updated the
Thing is, for the |
At this point, pretty sure it's not a typeorm issue. Let me know if you some agree and we can reopen. If you'd like to chat about it in general including debugging etc, ping me on the community slack - cheers! |
Your updated configuration worked (I still reference typeorm/browser though in code). Consider this closed, thank you! |
TypeORM pulls Native Modules on Browser import when using Metro
[X] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[ ]
postgres
[ ]
cockroachdb
[ ]
sqlite
[ ]
sqljs
[X]
react-native
[X]
expo
TypeORM version:
[X]
latest
[X]
@next
[X]
0.2.8
(or put your version here)Steps to reproduce or a small repository showing the problem:
I have tested multiple versions of TypeORM (including the latest Master) and am receiving the following error in Metro:
My current "metro.config.js":
My current "babel.config.js":
Notes:
registerRootComponent
)expo-sqlite
when they are initially included by TypeORMThe text was updated successfully, but these errors were encountered: