-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Transitive Dependency Bundling Issue: react-native-paper / react-native-vector-icons #7424
Comments
hey @fbartho! I think that in the ideal world we would split up react-native-paper with yarn workspaces/lerna, put |
Hey @brentvatne! I agree that the current world of tooling would encourage splitting into sub-packages:
I use / contribute to ApolloGraphQL, and several of their sets of repositories have sub packages: apollo-client, apollo-link Strictly speaking, they don't actually need yarn workspaces / lerna, as each sub-package & examples can be built/tested/integrated on it's own. They just happen to live in common repos, and that make extracting shared code and simultaneous iteration easier. |
As I'm sure you know, you could even maintain the |
Multiple packages are too much work that I'd like to avoid. Also all the navigators here share a lot of code, so it would mean another package for the shared code. The main issue here is that metro doesn't support optional dependencies, so there's not much we can do here to make vector icons optional. Regarding workspaces/lerna, they can't be used in React Native due to no symlink support in metro. In addition they make it impossible to install a package from git and make contribution harder. Though why do you link vector icons at all if you don't need it? What's an accelerator package? |
@satya164 the workspaces/lerna suggestion would be for development on the linked packages -- the deployed packages would not require workspaces/lerna. If you look at the links I provided above, apollo-client/apollo-link both deploy multiple packages, and have workspaces/lerna for contribution. And yes, the shared implementations would need to be in a shared package (I called it We use An accelerator package (my term), is a package that is very light, but has a bunch of important dependencies, and (optionally) contains some glue code that exposes those dependencies with some sane defaults -- it sort of functions as a "quick-start" to work with all the packages it wraps. apollo-boost is an example of an accelerator package. The code in the package is very simple and just sets some defaults, while importing ~10ish dependencies. You don't have to use the accelerator package, and you can "eject" from the accelerator package by including the dependencies yourself, and gluing things together your own way. |
We still need to use Metro for development which doesn't support symlinks. There are other issues like multiple roots etc. It's technically impossible to use it here. Apollo doesn't use Metro, so it's not relevant here.
Why do you run Anyway, the real solution here is to have support for optional require in metro. I posted on their discord if they have any plans about it. Let's wait for their reply. Also cc @grabbou is it possible to blacklist some native modules when running |
In answer to your questions @satya164 We have We also use @grabbou, I'd also love this feature, as |
Current behaviour
React-Navigation-Tabs includes
react-native-paper
as a direct dependency. It only uses this dependency increateMaterialBottomNavigator
.react-native-paper
includesreact-native-vector-icons
as apeerDependency
but a simple app instantly crashes with a bundler error ifreact-native-vector-icons
is not included in the simple app'spackage.json
If you include
react-native-vector-icons
, and runreact-native link
your app ends up getting all the vector-icon Font-assets linked in, and shipped as part of your app bundle.Expected behaviour
Since I don't expect to use MaterialBottomNavigator, I wouldn't expect to have a bundler crash complaining that the
react-native-vector-icons
isn't installed. I also wouldn't expect that using react-navigation-tabs forces me to add vector icons.What have you tried
Workaround:
.ttf
file additions to the app bundle / xcodeproj / assets (maybe via post-install script)Your Environment
The text was updated successfully, but these errors were encountered: