From 8cd5c8c47d50b12afa320d53c9e6b605e5f16da9 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Sat, 10 Sep 2022 14:08:37 +0200 Subject: [PATCH] use-sync-external-store: Add `exports` field to package.json --- packages/use-sync-external-store/package.json | 11 +++++++++++ .../src/useSyncExternalStoreWithSelector.js | 2 +- packages/use-sync-external-store/with-selector.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/use-sync-external-store/package.json b/packages/use-sync-external-store/package.json index b79c3501c05f4..7ffb0beecfd54 100644 --- a/packages/use-sync-external-store/package.json +++ b/packages/use-sync-external-store/package.json @@ -2,6 +2,17 @@ "name": "use-sync-external-store", "description": "Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.", "version": "1.2.0", + "exports": { + ".": "./index.js", + "./with-selector": "./with-selector.js", + "./shim": { + "react-native": "./shim/index.native.js", + "default": "./shim/index.js" + }, + "./shim/index.native": "./shim/index.native.js", + "./shim/with-selector": "./shim/with-selector/index.js", + "./package.json": "./package.json" + }, "repository": { "type": "git", "url": "https://github.com/facebook/react.git", diff --git a/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js b/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js index c7012e615ecd1..416ea4473eb7a 100644 --- a/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js +++ b/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js @@ -9,7 +9,7 @@ import * as React from 'react'; import is from 'shared/objectIs'; -import {useSyncExternalStore} from 'use-sync-external-store/src/useSyncExternalStore'; +import {useSyncExternalStore} from './useSyncExternalStore'; // Intentionally not using named imports because Rollup uses dynamic dispatch // for CommonJS interop. diff --git a/packages/use-sync-external-store/with-selector.js b/packages/use-sync-external-store/with-selector.js index e71d4dac6ac9d..93c1dfe5ed59d 100644 --- a/packages/use-sync-external-store/with-selector.js +++ b/packages/use-sync-external-store/with-selector.js @@ -9,4 +9,4 @@ 'use strict'; -export {useSyncExternalStoreWithSelector} from 'use-sync-external-store/src/useSyncExternalStoreWithSelector'; +export {useSyncExternalStoreWithSelector} from './src/useSyncExternalStoreWithSelector';