mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
fix(build): a workaround for ESM for use-sync-external-store (#953)
This commit is contained in:
parent
93ee10341e
commit
28e9614b78
@ -1,5 +1,9 @@
|
||||
import { useDebugValue } from 'react'
|
||||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'
|
||||
// import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'
|
||||
// This doesn't work in ESM, because use-sync-external-store only exposes CJS.
|
||||
// See: https://github.com/pmndrs/valtio/issues/452
|
||||
// The following is a workaround until ESM is supported.
|
||||
import useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector'
|
||||
import createStore, {
|
||||
EqualityChecker,
|
||||
Mutate,
|
||||
@ -10,6 +14,8 @@ import createStore, {
|
||||
StoreMutatorIdentifier,
|
||||
} from './vanilla'
|
||||
|
||||
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports
|
||||
|
||||
type ExtractState<S> = S extends { getState: () => infer T } ? T : never
|
||||
|
||||
type WithReact<S extends StoreApi<State>> = S & {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user