使用redux库构建vite失败

8nuwlpux  于 2023-06-23  发布在  其他
关注(0)|答案(1)|浏览(102)

我正在尝试构建一个包含react redux的vite应用程序,它给了我这个错误:

$ pnpm build

> temp-vite@1.0.0 build
> tsc && vite build

vite v4.3.9 building for production...
✓ 639 modules transformed.
✓ built in 1.67s
"createContext" is not exported by "../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.js", imported by "../../node_modules/.pnpm/react-redux@8.0.5_@types+react-dom@18.0.11_@types+react@18.0.37_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/components/Context.js".
file: .pnpm/react-redux@8.0.5_@types+react-dom@18.0.11_@types+react@18.0.37_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/components/Context.js:1:9
1: import { createContext } from 'react';
            ^
2: export const ReactReduxContext = /*#__PURE__*/createContext(null);
error during build:
RollupError: "createContext" is not exported by "../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.js", imported by "../../node_modules/.pnpm/react-redux@8.0.5_@types+react-dom@18.0.11_@types+react@18.0.37_react-dom@18.2.0_react@18.2.0_redux@4.2.1/node_modules/react-redux/es/components/Context.js".

ELIFECYCLE  Command failed with exit code 1.

有办法解决吗

相关问题