React 装饰器配置
首先安装:@babel/plugin-proposal-decorators
npm install -D @babel/plugin-proposal-decorators
根目录创建config-overrides.js
const {
override,
addDecoratorsLegacy
} = require("customize-cra");
module.exports = override(
addDecoratorsLegacy() //配置装饰器
);
安装:react-app-rewired、customize-cra
npm install react-app-rewired customize-cra --save-dev
修改 package.json
将:
"scripts": {
"start": "react-scripts start",
},
修改为:
"scripts": {
"start": "react-app-rewired start",
},