-
Notifications
You must be signed in to change notification settings - Fork 118
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
[BREAKING] feat: make resolver preset follow Metro defaults closely #525
Conversation
🦋 Changeset detectedLatest commit: 930a9a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
230bb31
to
b06e469
Compare
b06e469
to
4ecf0cc
Compare
What are possible migration paths, or differences in resolve behaviors that users could bump into unintentionally? This also shows some promise to remove now unnecessary webpack config overrides, can we provide some examples of what this means for the users in regards what can possibly change in their config? |
The only real difference is that Package Exports support is now disabled by default. There might be packages out there that don't declare
We still need to override the webpack config defaults, nothing changes in this regard. The API of |
Order of extensions now matches |
…525) * fix: getResolveOptions implementation * chore: add some additional descriptions * refactor: don't use default initializer, improve JSDoc * chore: make sure typedoc/jsdoc looks good * chore: add descriptive changeset * fix: mark options as optional * fix: align behaviour of conditions by platform in tests * refactor: add more tests to skip in metro-compat-test * test: enable metro-compat-test on CI * feat: use the same order of extensions as metro * chore: update changeset
…525) * fix: getResolveOptions implementation * chore: add some additional descriptions * refactor: don't use default initializer, improve JSDoc * chore: make sure typedoc/jsdoc looks good * chore: add descriptive changeset * fix: mark options as optional * fix: align behaviour of conditions by platform in tests * refactor: add more tests to skip in metro-compat-test * test: enable metro-compat-test on CI * feat: use the same order of extensions as metro * chore: update changeset
Summary
BREAKING CHANGE:
getResolveOptions
is now way more compatible withmetro-resolver
and@react-native/metro-config
getResolveOptions
now accepts a second optional parameter called options with the following properties:enablePackageExports
- defaults tofalse
preferNativePlatform
- defaults totrue
@react-native/metro-config
.exports
field in package.json) is now optional and disabled by default.It can now be enabled via
getResolveOptions
options parameter. This change was introduced to matchmetro
defaults.conditionNames
are now:['require', 'import', 'react-native']
and match@react-native/metro-config
defaults.Remarks
Implementation passes every
metro-compat
test with the following exceptions inpackage-exports-test
:sourceExts
- test should be marked as[nonstrict]
as it relies on unsupported fallback mechanism[nonstrict]
as it relies on unsupported fallback mechanismBar.js
should not be exposed by the package according to the Node spec, but instead fallback to using less specific specifier. This mechanism is used to restrict imports in packages and should be fixed upstreamChecklist
getResolveOptions
JSDoc
TypeDoc
compiles and displays new descriptions properlyTest plan
metro-compat
tests