-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix package exports #11059
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 package exports #11059
Conversation
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.
Pull Request Overview
This PR addresses a compatibility issue between the react-admin packages and @tanstack/react-query by updating the package exports format. The changes upgrade zshy from v0.4.4 to v0.5.0 and restructure the exports field in package.json files to avoid the "Masquerading as CJS" problem. Additionally, @tanstack/react-query is moved to peerDependencies for some packages to ensure consumers provide their own version.
Key changes:
- Upgraded
zshyto v0.5.0 across all packages - Added
--silentflag to zshy build commands - Restructured package exports to separate
importandrequireconditions with nested type declarations - Created an automated script to update package exports
- Moved
@tanstack/react-queryto peerDependencies inra-coreandra-ui-materialui
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/update-package-exports.ts |
New script to automatically update the exports field in all package.json files; transforms flat export structure to nested import/require format |
Makefile |
Adds update-package-exports target and integrates it into the build process |
yarn.lock |
Updates zshy from 0.4.4 to 0.5.0 with corresponding checksum changes |
packages/ra-core/package.json |
Updates exports structure, adds @tanstack/react-query to peerDependencies, adds --silent flag to build script |
packages/react-admin/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-ui-materialui/package.json |
Updates exports structure, moves @tanstack/react-query from dependencies to peerDependencies, adds --silent flag |
packages/ra-no-code/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-language-french/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-language-english/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-input-rich-text/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-i18n-polyglot/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-i18n-i18next/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-data-simple-rest/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-data-local-storage/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-data-local-forage/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-data-json-server/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-data-graphql/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-data-graphql-simple/package.json |
Updates exports structure and adds --silent flag to build script |
packages/ra-data-fakerest/package.json |
Updates exports structure and adds --silent flag to build script |
examples/data-generator/package.json |
Updates exports structure and adds --silent flag to build script |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem
We use zshy to build our packages but the exports cause issues with some of our dependencies (
@tanstack/react-query) because of Masquerading as CJSFixes #11054
Solution
Add a release script step to update our exports.
How To Test
make buildnpx create-react-admin@latest react-adminApp.tsxfile:=> You should not have any error.
Additional Checks
masterfor a bugfix or a documentation fix, ornextfor a feature