在@material-ui/icons
中如何使用最新版本的react-admin
有最佳实践吗?我想使用1.0.0
捆绑提供的ra-ui-materialui
版本中未包含的较新图标。
当我尝试在3.0.1
中使用@material-ui/icons
的较新版本(package.json
)时,构建有时会因以下内容而出错:
./ node_modules/ra-ui-materialui/node_modules/@material-ui/icons/FilterNone.js
找不到模块:“ @ babel / runtime / helpers / builtin / interopRequireDefault”。确保已安装此软件包。
使用与出厂版本(^1.0.0
相同的版本时,它始终可以正常运行,但是,我不能使用最近才添加的图标。
有没有解决这个难题的方法?
答案 0 :(得分:0)
您需要使用与react-admin中使用的相同的UI版本,然后才能使用最新的@ material-ui / icons版本。
样本包。Json
{
"name": "sample-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^1.4.0",
"@material-ui/icons": "^3.0.2",
"apollo-cache-inmemory": "^1.4.2",
"apollo-client": "^2.4.12",
"apollo-link": "^1.2.8",
"apollo-link-http": "^1.5.11",
"autosuggest-highlight": "^3.1.1",
"firebase": "^5.8.4",
"graphql": "^14.1.1",
"graphql-tag": "^2.10.1",
"inflection": "^1.12.0",
"moment": "^2.24.0",
"prop-types": "^15.6.2",
"ra-core": "^2.6.4",
"ra-data-hasura": "0.0.3",
"react": "^16.8.3",
"react-admin": "^2.6.2",
"react-admin-color-input": "^1.0.8",
"react-autosuggest": "^9.4.3",
"react-dom": "^16.8.3",
"react-redux": "~5.0.7",
"react-router-dom": "~4.2.2",
"react-router-redux": "^4.0.8",
"react-scripts": "^2.1.5",
"recompose": "^0.30.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}