You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be an issue with module augmentation and the exports field in package.json added in #5559 and improved in #5626. Module augmentation as described at https://react-select.com/typescript#custom-select-props appears to no longer work since react-select/dist/declarations/src/Select appears to no longer be the path of the Select module when the exports field in package.json is used during module resolution. I was unfortunately not able to figure out what the new path is. Deleting the exports field from package.json fixes the issue and module augmentation works as expected again.
The relevant section of building with tsc's traceResolution option enabled:
Failing with exports field being present
======== Resolving module 'react-select/dist/declarations/src/Select' from '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/types/module-augmentation.d.ts'. ========
Explicitly specified module resolution kind: 'Bundler'.
Resolving in CJS mode with conditions 'import', 'types'.
File '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/types/package.json' does not exist according to earlier cached lookups.
File '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/package.json' does not exist according to earlier cached lookups.
File '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/package.json' exists according to earlier cached lookups.
Loading module 'react-select/dist/declarations/src/Select' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/types/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/node_modules' does not exist, skipping all lookups in it.
File '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/package.json' exists according to earlier cached lookups.
Export specifier './dist/declarations/src/Select' does not exist in package.json scope at path '/Users/fabian/projects/brmlabs/brm/node_modules/react-select'.
Directory '/Users/fabian/projects/brmlabs/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/types/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/node_modules' does not exist, skipping all lookups in it.
File '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/package.json' exists according to earlier cached lookups.
Export specifier './dist/declarations/src/Select' does not exist in package.json scope at path '/Users/fabian/projects/brmlabs/brm/node_modules/react-select'.
Directory '/Users/fabian/projects/brmlabs/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
======== Module name 'react-select/dist/declarations/src/Select' was not resolved. ========
Succeeding with exports field being deleted from react-select's package.json:
Resolving in CJS mode with conditions 'import', 'types'.
File '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/types/package.json' does not exist according to earlier cached lookups.
File '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/package.json' does not exist according to earlier cached lookups.
File '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/package.json' exists according to earlier cached lookups.
Loading module 'react-select/dist/declarations/src/Select' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/types/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/dist/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/fabian/projects/brmlabs/brm/node_modules/chakra-react-select/node_modules' does not exist, skipping all lookups in it.
File '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/package.json' exists according to earlier cached lookups.
File '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/dist/declarations/src/Select.ts' does not exist.
File '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/dist/declarations/src/Select.tsx' does not exist.
File '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/dist/declarations/src/Select.d.ts' exists - use it as a name resolution result.
Resolving real path for '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/dist/declarations/src/Select.d.ts', result '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/dist/declarations/src/Select.d.ts'.
======== Module name 'react-select/dist/declarations/src/Select' was successfully resolved to '/Users/fabian/projects/brmlabs/brm/node_modules/react-select/dist/declarations/src/Select.d.ts' with Package ID 'react-select/dist/declarations/src/[email protected]'. ========
Seems like the root cause is ./dist/declarations/src/Select' missing from the exports map:
Export specifier './dist/declarations/src/Select' does not exist in package.json scope at path '/Users/fabian/projects/brmlabs/brm/node_modules/react-select'.
The text was updated successfully, but these errors were encountered:
I am running into this issue as well on my wrapper for this package chakra-react-select. I'm not sure this has anything to do with the change in #5626 though, as I'm having the same issue after reverting to v5.7.2. I'm really not too familiar with the inner workings of module augmentation, is there something that changed with it when using moduleResolution: "bundler"?
There seems to be an issue with module augmentation and the exports field in package.json added in #5559 and improved in #5626. Module augmentation as described at https://react-select.com/typescript#custom-select-props appears to no longer work since
react-select/dist/declarations/src/Select
appears to no longer be the path of theSelect
module when the exports field in package.json is used during module resolution. I was unfortunately not able to figure out what the new path is. Deleting the exports field from package.json fixes the issue and module augmentation works as expected again.The relevant section of building with tsc's
traceResolution
option enabled:Failing with exports field being present
Succeeding with exports field being deleted from react-select's package.json:
Seems like the root cause is
./dist/declarations/src/Select'
missing from the exports map:The text was updated successfully, but these errors were encountered: