关于报错Support for the experimental syntax 'decorators-legacy' isn't currently enabled

报错原因

装饰器写法不被支持

解决办法

bable转码

  1. npm install @babel/plugin-proposal-decorators
  2. 配置package.json
  "babel": {
    "plugins": [
      [
        "@babel/plugin-proposal-decorators",
        {
          "legacy": true
        }
      ]
    ],
    "presets": [
      "react-app"
    ]
  },

你可能感兴趣的:(关于报错Support for the experimental syntax 'decorators-legacy' isn't currently enabled)