-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix: Attempt to update for projects using moduleResolution="bundler"
by downgrading react-select
#284
Merged
Conversation
This file contains 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
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8337ea2:
|
📊 Package size report -3.11%↓
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
This was
linked to
issues
Sep 29, 2023
6 tasks
csandman
changed the title
fix: Attempt to update to
fix: Attempt to update for projects using Oct 3, 2023
moduleResolution="bundler"
and patch react-selectmoduleResolution="bundler"
by downgrading react-select
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.
This PR fixes the type issues people have been experiencing with all of the custom types included in this package. This issue was initially caused by upgrading the
react-select
dependency tov5.7.1
, in which theexports
field was added to theirpackage.json
. This is a relatively newer alternative to themain
andmodule
fields of the package.json in which people can define the paths at which different package parts can be imported by other packages. The problematic difference between this and the legacy fields, is that if a project finds the package paths using thisexports
field, it is limited to importing the files that are included in that exports field, and if a file is not included, it's impossible to access from the parent project. That is, as far as I'm aware, the whole node ecosystem is so fragmented and hard to keep track of so I'm not entirely sure about any of this, it's just what I've seen in practice.The problem here is that this package uses module augmentation to add extra props to the root select component that are specific to Chakra, like
size
,variant
, andchakraStyles
. This was done using the recommended approach from thereact-select
docs, however when they added the newexports
field, they did not account for the fact that they also had to include an export for these types in order for the module augmentation to still be possible.It took me a while to discover why this was only happening for some people and not others, but eventually I realized it was due to the
moduleResolution
setting in thetsconfig.json
file. If this property is set tobundler
,node16
, ornodenext
, that triggers the project to look for theexports
field in the package.json of dependencies (and nested dependencies apparently) which breaks the module augmentation in this package.This is a very simple fix for the
react-select
team, as all they have to do is add the type declaration files to theirexports
field and everything should work totally fine. I actually made a PR to their repo with a fix (JedWatson/react-select#5762), but their approval process can be kind of slow. If you'd like to help it along, interacting with that PR with a reaction or comment could help them to notice it.Considering the module augmentation is very fundamental to making this package work, I have decided that the best alternative is simply to downgrade this package's react-select version to
v5.7.0
, the version directly before the one that included the breaking change, until my PR or another fix is merged/published. Since that version, they have only had a few patch releases with nothing super important changing, so as long as my PR get's merged at some point, I'd rather stick to their older version for now.If this issue is not something that has affected you, and you'd like to continue using the latest version of
react-select
, you can always override this dependency version by using theoverrides
field in the package.json:And as soon as a fix is published for
react-select
, I will be upgrade the dependency to their newest version.Here are some related links:
selectedOptionStyle
andvariant
are missing fromSelect
types. #273