报错记录
SyntaxError: E:******\mobxtest\src\store\index.js: Support for the experimental syntax 'decorators-legacy' isn't currently enabled (4:3):
2 |
3 | class AppStore {
> 4 | @observable time = ''
| ^
5 | @observable todos = []
6 | }
7 |
参考
Syntax error - Support for the experimental syntax ‘decorators-legacy’ isn’t currently enabled
Support for the experimental syntax ‘decorators-legacy’ isn’t currently enabled
解决办法
cnpm install customize-cra react-app-rewired --save
//config-overrides.js
const { override, addDecoratorsLegacy } = require('customize-cra');
module.exports = override(
addDecoratorsLegacy()
);
//package.json
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
}
它活过来了!!!