我想用Primereact框架开发一个React Js应用程序。 现在我遇到了找不到某些导入的问题。
从"primereact/Button"导入导入{按钮}会引发异常: 找不到文件:"按钮.js"与磁盘上的相应名称不匹配:"。ode_modules\primereact\button.js
我遇到的第二个问题是找不到DatatableSubMenu和DatatableCrudDocu。什么是正确的导入?
我的包.json是:
"name": "selldesk",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^4.3.1",
"primeicons": "^2.0.0",
"primereact": "^3.3.2",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "^16.12.0",
"react-scripts": "3.2.0",
"reactstrap": "^8.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
我希望有人可以帮助我。
这是因为您导入的按钮不正确。
更改此内容
import {Button} from 'primereact/Button'; //uppercase
自
import {Button} from 'primereact/button'; //lowercase
确保它们保持小写。检查文档以获取正确的导入语句 -
https://www.primefaces.org/primereact/#/button