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):

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

时间: 2024-07-30 05:47:31

Support for the experimental syntax 'decorators-legacy' isn't currently enabled (7:1):的相关文章

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

baidu上面的说法大多是在 项目的package.json 中添加decorators-legacy 因为引入了antd的按需加载 所以只需要在config-overrides.js中添加addDecoratorsLegacy() const { override, fixBabelImports,addDecoratorsLegacy } = require('customize-cra'); module.exports = override( fixBabelImports('impor

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

在写react项目创建class时使用了静态属性,但是在打包的时候报错: 根据报错提示下载@babel/plugin-proposal-class-properties包,并在.babelrc文件中的"plugins"里添加一项"@babel/plugin-proposal-class-properties" { "presets": ["@babel/preset-env", "@babel/preset-reac

解决Webpack中提示syntax 'classProperties' isn't currently enabled的错误

当我们使用了一些JavaScript的一些新特性的时候,但是有没有在webpack.config.js里面或者是.babelrc文件中配置相关插件,就可以解决了. error:Support for the experimental syntax 'classProperties' isn't currently enable 解决方案:安装如下插件 npm i -D @babel/plugin-proposal-class-properties 在babelrc中配置插件: options:

ES6入门六:class的基本语法、继承、私有与静态属性、修饰器

基本语法 继承 私有属性与方法.静态属性与方法 修饰器(Decorator) 一.基本语法 1 class Grammar{ 2 constructor(name,age){ //定义对象自身的方法和属性 3 this.name = name, 4 this.age = age 5 } 6 // 在原型上定义只读属性 7 get inva(){ 8 return "JS"; 9 } 10 //在原型上定义可读写属性 11 set skill(val){ 12 this._skill =

create-react-app 构建的项目使用 mobx

在 create-react-app 命令行构建的 React 项目中使用 Mobx 会出现如下警告: Support for the experimental syntax 'decorators-legacy' isn't currently enabled (9:5): 需要启用 ESNext 的装饰器 (命令行中执行 mac 端) 先 git add . git commit -am "Save before ejecting" (然后(注意这里是 am) npm run ej

[android]com.android.support:appcompat-v7:XXX 包导入无法Build

在学习<Android编程权威指南>时,按书中要求添加com.android.support:appcompat的依赖,然后编译不通过,提示如下问题: 大概意思是,Android Pie之前支持这个库,我们建议迁移到AndroidX libraries…… 然后搜索了一下,原来2018年google开发者大会以后,相关库已经整合到AndroidX库中,这里放一个链接:(别人的说明) 1. AndroidX变化 1)常用依赖库对比: Old build artifact AndroidX bui

Angular2版本更新

2.0.0-beta.0 somnambulant-inauguration (2015-12-15) Enjoy! 2.0.0-alpha.55 (2015-12-15) Bug Fixes router: export ROUTER_LINK_DSL_PROVIDER and hide MockPopStateEvent (fc75220) Features core: enable dev mode by default (3dca9d5) BREAKING CHANGES Before

YASM User Manual

This document is the user manual for the Yasm assembler. It is intended as both an introduction and a general-purpose reference for all Yasm users. 1.?Introduction Yasm is a BSD-licensed assembler that is designed from the ground up to allow for mult

【PHP】PHP5.4.0版本ChangeLog详解(上)

前言 随着大量的框架使用composer和namespace,渐渐的线上环境也从之前的5.3变成了5.4或者5.5甚至5.6,随着7月份PHP7的发布,会有更多的公司采用新版本. 之前好久就想写这样的一片文章,来说明下各个版本的差异,这次算是拿出时间了. 这次的是第一篇,目前规划写三篇 PHP5.4.0 PHP5.5.0 PHP5.6.0 一方面是对自己的知识的整理,一方面是对自己的一次提升. 官方说明 官方文档地址 http://php.net/ChangeLog-5.php#5.4.0 详细