Skip to content

Commit

Permalink
Restore 'import' in default Package Exports conditions (facebook#36902)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#36902

Reverts facebook#36584.

Since we've come across example packages (typically targeting Node.js) which only distribute ESM, we believe it's more helpful to return to asserting the `"import"` condition by default, for maximum compatibility. The above issue and comments outline the pros/cons.

Changelog:
[General][Changed] - Default condition set for experimental Package Exports is now ['require', 'import', 'react-native']

Metro changelog: [Experimental] Package Exports unstable_conditionNames now defaults to ['require', 'import']

Reviewed By: robhogan

Differential Revision: D44962143

fbshipit-source-id: d2004df313c858c70bc41c5e096ae2ab9f627bc1
  • Loading branch information
huntie authored and facebook-github-bot committed Apr 14, 2023
1 parent 3b4037e commit 98311be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/metro-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getDefaultConfig(
resolver: {
resolverMainFields: ['react-native', 'browser', 'main'],
platforms: ['android', 'ios'],
unstable_conditionNames: ['require', 'react-native'],
unstable_conditionNames: ['require', 'import', 'react-native'],
},
serializer: {
getPolyfills: () => require('@react-native/js-polyfills')(),
Expand Down

0 comments on commit 98311be

Please sign in to comment.