【发布时间】:2021-12-22 22:18:17
【问题描述】:
我在使用 reactstrap、bootstrap 和 nextjs 时遇到了这个错误
Server Error
SyntaxError: The requested module 'react-popper' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'react-popper';
const { Manager, Popper, Reference } = pkg;
这是我的 package.json 文件
"@apollo/react-hooks": "^3.1.5",
"@apollo/react-ssr": "^3.1.5",
"@emotion/cache": "^11.5.0",
"@emotion/react": "^11.5.0",
"@emotion/server": "^11.4.0",
"@emotion/styled": "^11.3.0",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@popperjs/core": "^2.10.2",
"apollo-boost": "^0.4.7",
"apollo-link-http": "^1.5.17",
"axios": "^0.24.0",
"bootstrap": "^5.1.3",
"express": "^4.17.1",
"graphql": "^15.0.0",
"isomorphic-fetch": "^2.2.1",
"js-cookie": "^2.2.1",
"next": "^12.0.1",
"next-apollo": "^3.1.10",
"next-with-apollo": "^5.2.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-popper": "^2.2.5",
"reactstrap": "^9.0.0"
我在网上查了一些文章,建议我安装 react-popper 和 @popperjs/core,我安装了,但没有成功
【问题讨论】:
-
也许你可以看看react-bootstrap.github.io/getting-started/introduction。这是为 react 重建的,并使用 bootstrap v5
-
谢谢,但它们是同一个框架
标签: reactjs twitter-bootstrap next.js react-dom reactstrap