Skip to content

Conversation

@djhi
Copy link
Collaborator

@djhi djhi commented Nov 21, 2025

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 CJS

Fixes #11054

Solution

Add a release script step to update our exports.

How To Test

  • make build
  • npx create-react-admin@latest react-admin
  • then update the App.tsx file:
import { Admin } from "react-admin";
import { QueryClient } from "@tanstack/react-query";

import { Layout } from "./Layout";

const queryClient = new QueryClient();

export const App = () => (
  <Admin layout={Layout} queryClient={queryClient}></Admin>
);

=> You should not have any error.

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature

@djhi djhi added the RFR Ready For Review label Nov 21, 2025
@slax57 slax57 requested review from Copilot and slax57 November 21, 2025 09:18
Copilot finished reviewing on behalf of slax57 November 21, 2025 09:21
Copy link
Contributor

Copilot AI left a 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 zshy to v0.5.0 across all packages
  • Added --silent flag to zshy build commands
  • Restructured package exports to separate import and require conditions with nested type declarations
  • Created an automated script to update package exports
  • Moved @tanstack/react-query to peerDependencies in ra-core and ra-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.

@slax57 slax57 added this to the 5.13.2 milestone Nov 21, 2025
@slax57 slax57 merged commit e147dc6 into master Nov 21, 2025
21 checks passed
@slax57 slax57 deleted the fix-exports-2 branch November 21, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Development

Successfully merging this pull request may close these issues.

Consider making @tanstack/react-query a peer dependency and not a dependency

3 participants