react-spaces icon indicating copy to clipboard operation
react-spaces copied to clipboard

stop use `React.unstable_useOpaqueIdentifier` that issues an rsbuild compile error

Open tiny-ant opened this issue 9 months ago • 0 comments

Describe the bug I'm using rsbuild to optimize the build performance, but react-spaces interupt the compile process and throw the following errors:

.../node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/react-spaces/dist/es/index.js:1:1
  × ESModulesLinkingError: export 'unstable_useOpaqueIdentifier' (imported as 'React') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, act, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, startTransition, unstable_act, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version)
      ╭─[1304:12]
 1302 │             return "s" + React.useId().replace(/\:/g, "");
 1303 │         }
 1304 │         if (React.unstable_useOpaqueIdentifier) {
      ·             ──────────────────────────────────
 1305 │             return "s" + React.unstable_useOpaqueIdentifier().replace(/\:/g, "");
 1306 │         }

I see that unstable_useOpaqueIdentifier was a deprecated experimental API of React 17, I think these unstable APIs can be avoided anyway.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Package versions (please complete the following information):

  • React version: 18.2.0
  • React spaces version: 0.5.0

tiny-ant avatar Mar 26 '25 06:03 tiny-ant