Support for the experimental syntax ‘decorators-legacy‘ isn‘t currently enabled

  • react 加装饰器需要用babel解析
  • 但是用啦很多方法都不管用
  • 最后找到啦一个方法
  • 可以供参考
//1. 安装依赖
npm i customize-cra react-app-rewired @babel/plugin-proposal-decorators
//2. 项目根目录下建config-overrides.js 加入代码:
const { override, addDecoratorsLegacy } = require('customize-cra');
module.exports = override(
 addDecoratorsLegacy()
);
//3.修改package.json文件
"scripts": {
     "start": "react-app-rewired start",
     "build": "react-app-rewired build",
     "test": "react-app-rewired test",
     "eject": "react-app-rewired eject"
}
//4. 重启项目
npm start
上一篇:Some App Tech Support


下一篇:[XILINX-ACAP] AI Engine Architecture