Support for the experimental syntax 'decorators-legacy' isn't currently enabled
react项目中自己写了一个装饰器,运行的时候发现报错
Support for the experimental syntax 'decorators-legacy' isn't currently enabled
这是因为我们么有装支持装饰器的组件
Support for the experimental syntax 'decorators-legacy' isn't currently enabled
然后 npm run eject
在package.json文件下找到bebel属性
增加下面配置
"plugins": [ [ "@babel/plugin-proposal-decorators", { "legacy": true } ] ]
项目重启
文章借鉴于https://blog.csdn.net/qq_41831345/article/details/101287368