-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
use-sync-external-store: Add exports
field to package.json
#25231
base: main
Are you sure you want to change the base?
Conversation
Comparing: 1e3e30d...360fe3d Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
8cd5c8c
to
3cf0eb2
Compare
exports
field to package.jsonexports
field to package.json
3cf0eb2
to
62a5371
Compare
"react-native": "./shim/index.native.js", | ||
"default": "./shim/index.js" | ||
}, | ||
"./shim/index.native": "./shim/index.native.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For compat with bundlers that don't support the react-native
condition. Though I don't know if we need it. I just copied it from #24440
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/__tests__/useSyncExternalStoreNative-test.js#L45
It seems that this entry has been used in several places. I'm not sure if this is necessary.
packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js
Outdated
Show resolved
Hide resolved
62a5371
to
360fe3d
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
360fe3d
to
f7f5817
Compare
f7f5817
to
4b94040
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matches the layout we have in ./npm
4b94040
to
d77e5f6
Compare
These are the likely candidates of public entrypoints to have been used with strict module resolution. `./cjs/` is not supported because that means you'd be able to choose dev vs prod which you shouldn't.
@markerikson Does this change work for you? |
Closes #24590
Closes #26230
Summary
Adds
exports
fields for the following entrypoints:There's an argument to be made that this should be a SemVer MAJOR e.g.
use-sync-external-store/cjs/*
no longer works. I wouldn't consider these part of the public interface though. If we make it SemVer major we can remove all the legacy entrypoints. Feels a bit too disruptive for this feature. With support for legacy entrypoints this should be non-breaking. So a SemVer MAJOR punishes the libraries using public entrypoints just to safeguard the ones using internals.How did you test this change?