From ee4b9cc5f4a54622a62974b18cc19ff71ee021dc Mon Sep 17 00:00:00 2001 From: artalar Date: Wed, 13 Nov 2024 14:21:18 +0300 Subject: [PATCH] fix(npm-react): webpack bug --- packages/npm-react/src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/npm-react/src/index.ts b/packages/npm-react/src/index.ts index 3ec31383..0d349aa1 100644 --- a/packages/npm-react/src/index.ts +++ b/packages/npm-react/src/index.ts @@ -24,10 +24,11 @@ import { toAbortError } from '@reatom/utils' // useIsomorphicEffect removes it by replacing useLayoutEffect with useEffect during ssr export const useIsomorphicEffect = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect +// @ts-expect-error https://github.com/webpack/webpack/issues/12960#issuecomment-1086272918 +const { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } = React + export const getComponentDebugName = (type: string): string => { - let Component = - // @ts-expect-error do we have another way? - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current?.type + let Component = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current?.type let name = Component?.displayName ?? Component?.name return name ? `Component.${name}.${type}` : `_${type}`