Reactjs 在我的项目中使用mobx时是否有问题,错误是';支持实验语法';装饰者遗产';isn';t当前已启用';
我配置了package.json和babelrc,但在使用decorator时出现了一些错误 我使用“react16.8.1”和“mobx5.9.4” 我的LRC代码:Reactjs 在我的项目中使用mobx时是否有问题,错误是';支持实验语法';装饰者遗产';isn';t当前已启用';,reactjs,mobx,mobx-react,Reactjs,Mobx,Mobx React,我配置了package.json和babelrc,但在使用decorator时出现了一些错误 我使用“react16.8.1”和“mobx5.9.4” 我的LRC代码: "presets": [ "@babel/preset-env", "@babel/preset-react", ], "plugins": [ "@babel/plugin-transform-runtime", "@babel/plug
"presets": [
"@babel/preset-env",
"@babel/preset-react",
],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-transform-object-assign",
[
"@babel/plugin-decorators-legacy",
{
"legacy": true
}
],
]
}```
and my package.json
{
“名称”:“材料仪表板专业反应”,
“版本”:“1.5.0”,
“私人”:没错,
“依赖项”:{
“@material ui/core”:“3.9.2”,
“@material ui/图标”:“3.0.2”,
“axios”:“^0.18.0”,
“babel插件转换装饰程序传统”:“^1.3.5”,
“图表专家”:“0.10.1”,
“历史”:“4.7.2”,
“mobx”:“^5.9.4”,
“mobx反应”:“^5.4.3”,
“时刻”:“2.24.0”,
“jalaali时刻”:“^0.8.3”,
“节点sass”:“4.11.0”,
“nouislider”:“13.1.0”,
“完美滚动条”:“1.4.0”,
“rc分页”:“^1.17.13”,
“反应”:“16.8.1”,
“反应大日历”:“0.20.3”,
“react bootstrap sweetalert”:“4.4.1”,
“反应图表师”:“0.13.3”,
“反应日期时间”:“2.16.3”,
“反应dom”:“16.8.1”,
“反应谷歌地图”:“9.4.5”,
“react hichestan datetimepicker”:“^0.2.12”,
“react jvectormap”:“0.0.6”,
“反应路由器dom”:“4.3.1”,
“反应脚本”:“2.1.5”,
“反应选择”:“^2.4.2”,
“react swipeable视图”:“0.13.1”,
“反应表”:“6.9.2”,
“反应标记输入”:“3.19.0”,
“快速反应”:“^5.0.0”,
“简单反应模式”:“^0.5.1”
},
“脚本”:{
“开始”:“反应脚本开始”,
“构建”:“反应脚本构建”,
“测试”:“反应脚本测试--env=jsdom”,
“弹出”:“反应脚本弹出”,
“部署”:“npm运行构建”,
“lint:检查”:“eslint。--ext=js,jsx;退出0”,
“lint:fix”:“eslint。--ext=js,jsx--fix;退出0”,
},
“可选依赖项”:{
“@types/googlemaps”:“3.30.16”,
“@types/markerclustererplus”:“2.1.33”,
“ajv”:“6.9.1”,
“更漂亮”:“1.16.4”
},
“依赖性”:{
“babel插件转换装饰程序传统”:“^1.3.5”,
“巴别塔预设mobx”:“^2.0.0”,
“eslint config prettier”:“4.0.0”,
“eslint插件更漂亮”:“3.0.1”
},
“巴别塔”:{
“预设”:[
“反应应用程序”,
“mobx”
],
“插件”:[
[
“@babel/plugin decorators legacy”,
{
“遗产”:真实
}
]
]
},
“浏览者”:[
">0.2%",
“没有死”,
“不是ie看看:是的,我知道,昨天我解决了它,我使用了mobx实用程序,一切都很好,我认为这个问题与mobx有关,但它取决于babel!因为我认为babel 7不能支持github中基于这个问题的装饰程序
{
"name": "material-dashboard-pro-react",
"version": "1.5.0",
"private": true,
"dependencies": {
"@material-ui/core": "3.9.2",
"@material-ui/icons": "3.0.2",
"axios": "^0.18.0",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"chartist": "0.10.1",
"history": "4.7.2",
"mobx": "^5.9.4",
"mobx-react": "^5.4.3",
"moment": "2.24.0",
"moment-jalaali": "^0.8.3",
"node-sass": "4.11.0",
"nouislider": "13.1.0",
"perfect-scrollbar": "1.4.0",
"rc-pagination": "^1.17.13",
"react": "16.8.1",
"react-big-calendar": "0.20.3",
"react-bootstrap-sweetalert": "4.4.1",
"react-chartist": "0.13.3",
"react-datetime": "2.16.3",
"react-dom": "16.8.1",
"react-google-maps": "9.4.5",
"react-hichestan-datetimepicker": "^0.2.12",
"react-jvectormap": "0.0.6",
"react-router-dom": "4.3.1",
"react-scripts": "2.1.5",
"react-select": "^2.4.2",
"react-swipeable-views": "0.13.1",
"react-table": "6.9.2",
"react-tagsinput": "3.19.0",
"react-toastify": "^5.0.0",
"simple-react-modal": "^0.5.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"deploy": "npm run build",
"lint:check": "eslint . --ext=js,jsx; exit 0",
"lint:fix": "eslint . --ext=js,jsx --fix; exit 0",
},
"optionalDependencies": {
"@types/googlemaps": "3.30.16",
"@types/markerclustererplus": "2.1.33",
"ajv": "6.9.1",
"prettier": "1.16.4"
},
"devDependencies": {
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-mobx": "^2.0.0",
"eslint-config-prettier": "4.0.0",
"eslint-plugin-prettier": "3.0.1"
},
"babel": {
"presets": [
"react-app",
"mobx"
],
"plugins": [
[
"@babel/plugin-decorators-legacy",
{
"legacy": true
}
]
]
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}