Relative path for provided variables makes it hard to reuse them
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue description
In Relay v14, provided variables modules paths were not transformed, allowing the specification of a module path relative to `artifactDirectory`. This enabled the reuse of these modules between fragments in different components.
However, in Relay v15, the generated path is based on the relative path between artifactDirectory and the module using the providers. This behavior prevents the reuse of provided variables between two modules that have different relative paths to the provided variables modules, resulting in errors like:
```
Modules '../../PixelRatio.relayprovider' and '../PixelRatio.relayprovider' used by provided variables have indistinguishable names. (All non ascii-alphanumeric characters are stripped in Relay transform)
```
Moreover, it also prevents the usage of mapped paths for provided variables module paths, such as `#relayProviders/PixelRatio.relayprovider`.
## Proposed solutions
- Introduce a configuration property that prevents Relay from transforming the path of provided variables. This would allow users to choose between the previous behavior and the new behavior introduced in v15.
- Prevent the transformation of relay provider module paths if they are not in a relative path format.
Contributor guide
Assessment
This issue has not been assessed yet.