refactor: drop commonjs build from default setup#800
Merged
Conversation
3352d8f to
94fd772
Compare
94fd772 to
18126b9
Compare
7a65f9d to
5c773be
Compare
5c773be to
3324a3f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's a possibility of dual package hazard with the current setup. Metro enables
exportssupport from 0.82.0, so this can become a problem for some packages.So this drops the dual package setup in favor of an ESM-only setup. To make a similar change in your package, apply the following change to your entrypoints:
Also, remove the
commonjstarget from thereact-native-builder-bobfield in yourpackage.jsonorbob.config.jsorbob.config.mjs:"react-native-builder-bob": { "source": "src", "output": "lib", "targets": [ ["module", { "esm": true }], - ["commonjs", { "esm": true }] "typescript", ] }With this change, Jest will break for the consumers of your libraries due to the usage of ESM syntax. So they may need to update their Jest configuration to transform your library:
If consumers of your library are using it in NodeJS in a CommonJS environment, they'll need to use at least NodeJS v20.19.0 to be able to synchronously
requireyour library.You can read more at our ESM support docs.