You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set transformer.allowOptionalDependencies to true by default #1348
This is particularly useful for library authors, and would have been helpful during the "lean core" efforts (react-native-community/discussions-and-proposals#120) but will continue to be useful in environments where libraries want to either: a) support multiple implementations of some primitive and automatically switch between them depending on which one the developer uses b) provide some behavior in their library that works if the developer has installed an optional peer dependency or fallback to something else and/or provide some warning otherwise.
Possible Implementations
We would just need to add allowOptionalDependencies: true to the default transformer config in
This should not break any existing apps, but libraries that adopt optional imports will only work on newer versions of Metro/this CLI that use this config.
one more question - do you think it would be possible to backport this and a version bump to depend on metro@0.59 (the first release that includes this feature - it shipped in March of last year) to a CLI version that is compatible with react-native@0.63? we're hoping to leverage this functionality to move away from .expo.js extensions
Activity
thymikee commentedon Jan 19, 2021
Sure, sounds reasonable and non-breaking. Happy to accept a PR :)
brentvatne commentedon Jan 20, 2021
@thymikee - will open a PR for this shortly!
one more question - do you think it would be possible to backport this and a version bump to depend on metro@0.59 (the first release that includes this feature - it shipped in March of last year) to a CLI version that is compatible with react-native@0.63? we're hoping to leverage this functionality to move away from
.expo.jsextensionsthymikee commentedon Jan 20, 2021
Yup, we can do it!
brentvatne commentedon Feb 6, 2021
merged in #1350