diff --git a/packages/react-query/src/useSyncExternalStore.native.ts b/packages/react-query/src/useSyncExternalStore.native.ts index 226ccef519..f27367a18a 100644 --- a/packages/react-query/src/useSyncExternalStore.native.ts +++ b/packages/react-query/src/useSyncExternalStore.native.ts @@ -1,3 +1,5 @@ // Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601 // @ts-ignore -export { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js' +import { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js' + +export { useSyncExternalStore } diff --git a/packages/react-query/src/useSyncExternalStore.ts b/packages/react-query/src/useSyncExternalStore.ts index c2b6d1454e..ed857e6740 100644 --- a/packages/react-query/src/useSyncExternalStore.ts +++ b/packages/react-query/src/useSyncExternalStore.ts @@ -1,2 +1,4 @@ // Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601 -export { useSyncExternalStore } from 'use-sync-external-store/shim/index.js' +import { useSyncExternalStore as uSES } from 'use-sync-external-store/shim/index.js' + +export const useSyncExternalStore = uSES diff --git a/rollup.config.ts b/rollup.config.ts index b450379aa6..a3188d07b0 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -80,12 +80,13 @@ export default function rollup(options: RollupOptions): RollupOptions[] { packageDir: 'packages/react-query', jsName: 'ReactQuery', outputFile: 'index', - entryFile: ['src/index.ts', 'src/reactBatchedUpdates.native.ts'], + entryFile: ['src/index.ts', 'src/reactBatchedUpdates.native.ts', 'src/useSyncExternalStore.native.ts'], globals: { react: 'React', 'react-dom': 'ReactDOM', '@tanstack/query-core': 'QueryCore', 'use-sync-external-store/shim/index.js': 'UseSyncExternalStore', + 'use-sync-external-store/shim/index.native.js': 'UseSyncExternalStoreNative', 'react-native': 'ReactNative', }, bundleUMDGlobals: [ @@ -321,6 +322,7 @@ function cjs({ // TODO: figure out a better way to produce extensionless cjs imports "require('./logger.js')": "require('./logger')", "require('./reactBatchedUpdates.js')": "require('./reactBatchedUpdates')", + "require('./useSyncExternalStore.js')": "require('./useSyncExternalStore')", preventAssignment: true, delimiters: ['', ''], }),