React 17 ESbuild - @emotion/react 出现问题,在“react”中找不到导出“useInsertionEffect”(导入为“React”)

Roh*_*acu 7 emotion reactjs webpack babel-loader esbuild

你好吗?

我有一个使用React 17babel-loader 的项目,我正在尝试将其更改为esbuild-loader。为此,我安装了"esbuild-loader": "2.19.0"并将我的 webpack 加载器配置更改为:

{
  test: /\.js$/,
  loader: 'esbuild-loader',
  options: {
    loader: 'jsx', // Remove this if you're not using JSX
    target: 'es2015' // Syntax to compile to (see options below for possible values)
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试构建我的应用程序时,它现在抛出以下错误:

./node_modules/react-select/node_modules/@emotion/react/dist/emotion-element-cbed451f.browser.esm.js 107:25-52 中的警告未找到导出“useInsertionEffect”(导入为“React”) 'react'(可能的导出:Children、Component、Fragment、Profiler、PureComponent、StrictMode、Suspense、__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED、cloneElement、createContext、createElement、createFactory、createRef、forwardRef、isValidElement、lazy、memo、useCallback、useContext、useDebugValue、useEffect、useImperativeHandle 、useLayoutEffect、useMemo、useReducer、useRef、useState、版本)

根据我的研究,这似乎是最新版本的@emotion/react解决的问题,但是,我尝试安装@emotion/react@11.10.0并且问题仍然存在。

有人经历过这个吗?如果是这样,你是如何解决的?

提前致谢!