阅读:3186回复:0
[前端]【react】Support for the experimental syntax 'decorators-legacy' isn't currently enabled
问题:
react项目中自己写了一个装饰器,运行的时候发现报错 Support for the experimental syntax 'decorators-legacy' isn't currently enabled 原因:这是因为项目中使用了支持装饰器的组件 解决方案: 执行 npm run eject 在package.json文件下找到bebel属性 增加下面配置 "plugins": [ [ "@babel/plugin-proposal-decorators", { "legacy": true } ] ] 重启项目就OK了参考:https://blog.csdn.net/qq_41831345/article/details/101287368 |
|
|