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

Posted weizhxa

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Support for the experimental syntax 'decorators-legacy' isn't currently enabled (7:1):(示相关的知识,希望对你有一定的参考价值。

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):(示的主要内容,如果未能解决你的问题,请参考以下文章

MetaException(message:For direct MetaStore DB connections, we don't support retries at the clien

webpack打包时报错:Support for the experimental syntax 'classProperties' isn't currently enabl

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

在ubuntu下用SecureCRT连接时,出现license does not include support for the SSH2 protocol.求帮助?

react+mobx+antd按需加载 出现Support for the experimental syntax 'decorators-legacy' isn't curr

增加超时限制 gatsby-source-wordpress-experimental