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