Metro doesn’t support custom loaders like that I believe. Maybe you could write a custom Babel plugin but you’d probably need to read through the Metro bundler code to figure out what to do. The code is here: https://github.com/facebook/metro.
Thanks @ide and @fson for your quick answers and kind support. @ide I’m not sure I’ve the skill to develop such plugin yet. But I would love to be able to do it one day. @fson this plugin seems to work fine but it doesn’t support #fragments importation.
I’ve a folder tree with lot of Graphql queries. Many of them directly import fragment definitions from same folder tree. I use it also for the react web application and it’s why I’m looking for a solution that could work the same way to be able to share this graphql library folder.