码迷,mamicode.com
首页 > 其他好文 > 详细

Support for the experimental syntax 'decorators-legacy' isn't currently enabled (7:1):

时间:2019-10-17 12:06:37      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:file   The   并且   驱动   eset   add   ack   ant   解决   

1、产生原因:项目不支持装饰器

2、解决方法:

  2.1 执行

yarn 

  安装完整依赖;

 

  2.2 如果依赖时yarn.lock变化了,并且项目有git目录,则将提示的文件提交到git仓库  

? Are you sure you want to eject? This action is permanent. Yes
This git repository has untracked files or uncommitted changes:

yarn.lock

  

  2.3 执行:

yarn eject

  

  2.4 执行

yarn add @babel/plugin-proposal-decorators

  安装装饰器驱动

 

  2.5 将package.json中的babel依赖修改为:

"babel": {
    "plugins": [
      [
        "@babel/plugin-proposal-decorators",
        {
          "legacy": true
        }
      ]
    ],
    "presets": [
      "react-app"
    ]
  },

  

  2.6 执行项目即可。

yarn start

  

 

Support for the experimental syntax 'decorators-legacy' isn't currently enabled (7:1):

标签:file   The   并且   驱动   eset   add   ack   ant   解决   

原文地址:https://www.cnblogs.com/weizhxa/p/11691004.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!