1.npm run eject (返编译)
2.npm i (全部重新安装依赖)
3.npm install --save-dev babel-plugin-transform-decorators-legacy (安装该模块中间可能有告警自行消除即可)
4.npm install @babel/plugin-proposal-decorators
5.在 package.json 里修改 babel 如下所示
"babel": {
"plugins":[

[
  "@babel/plugin-proposal-decorators",
  {
    "legacy":true
  }
],
[
  "@babel/plugin-proposal-class-properties",
  {
    "loose":true
  }
]

],
"presets":[

"react-app"

]
},
6npm start就可以了


梦幻影
1 声望0 粉丝

create-react-app 构建的项目使用 mobx Support for the experimental syntax 'decorators-legacy' isn't currently enabled