create-react-app 使用装饰器报错Support for the experimental syntax ‘decorators-legacy’ isn’t currently…@TOC
使用customize-cra、react-app-rewired
npm install customize-cra react-app-rewired @babel/plugin-proposal-decorators --save
在项目根目录创建config-overrides.js
const { override, addDecoratorsLegacy } = require('customize-cra');
module.exports = override(addDecoratorsLegacy());
修改package.json的scripts
"scripts": {"start": "react-app-rewired start","build": "react-app-rewired build","test": "react-app-rewired test","eject": "react-app-rewired eject"},