简体   繁体   English

React - 当前未启用“classProperties”

[英]React - 'classProperties' isn't currently enabled

I added Truncate-react to my project.我在我的项目中添加了Truncate-react After that, React tells me I need to install @babel/plugin-proposal-class-properties , which I did in package.json file in this way:之后,React 告诉我需要安装@babel/plugin-proposal-class-properties ,我在package.json文件中以这种方式安装:

      "babel": {
        "presets": [
          "@babel/preset-env",
          "@babel/preset-react"
        ],
        "plugins": [
          [
            "@babel/plugin-proposal-class-properties",
            {
              "loose": true
            }
          ]
        ]
      }

Of course, the proposal-class-properties itself I installed with the label --save-dev当然, proposal-class-properties本身是我用标签--save-dev安装的

but after all this, I still get an error that looks like this但毕竟这一切,我仍然收到一个看起来像这样的错误这个

based on the github link you sent you have to do 2 things to make it work根据您发送的 github 链接,您必须做两件事才能使其正常工作

  1. you have both .babelrc file and babel config in your package.json.你的 package.json 中有 .babelrc 文件和 babel 配置。 you have to choose one.你必须选择一个。
  2. You have to change import TextTruncate from 'react-text-truncate/src/TextTruncate' to import TextTruncate from 'react-text-truncate' in VideoCard component.您必须在import TextTruncate from 'react-text-truncate/src/TextTruncate' import TextTruncate from 'react-text-truncate' I assume react-text-truncate/src/TextTruncate this file is not the compiled version我假设 react-text-truncate/src/TextTruncate 这个文件不是编译版本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当前未启用反应组件模块“classProperties” - react component module 'classProperties' isn't currently enabled React.js 当前未启用对实验性语法“classProperties”的支持错误 - Support for the experimental syntax 'classProperties' isn't currently enabled error on a React.js 使用 Jest、Babel、Webpack 和 React 进行测试。 当前未启用对实验性语法“classProperties”的支持 - Testing with Jest, Babel, Webpack, and React. Support for the experimental syntax 'classProperties' isn't currently enabled Laravel:当前未启用对实验语法“classProperties”的支持 - Laravel: Support for the experimental syntax 'classProperties' isn't currently enabled 如何解决问题当前未启用对实验性语法“classProperties”的支持 - How to solve the problem Support for the experimental syntax 'classProperties' isn't currently enabled “松散”:true 未修复当前未启用对实验性语法“classProperties”的支持 - "loose": true is not fixing Support for the experimental syntax 'classProperties' isn't currently enabled @babel/plugin-proposal-class-properties 仍然失败,“classProperties 当前未启用” - @babel/plugin-proposal-class-properties Still Fails with "classProperties isn't currently enabled" 当前未启用对实验语法“classProperties”的支持 (8:16)。 添加@babel/plugin-proposal-class-properties - Support for the experimental syntax 'classProperties' isn't currently enabled (8:16). Add @babel/plugin-proposal-class-properties 尝试在monorepo项目中配置Babel-当前未启用'classProperties'。 如何在monorepo项目中设置Babel? - Trying to configure Babel in a monorepo project - 'classProperties' isn't currently enabled. How to set up Babel in a monorepo project? React Native 中当前未启用对实验性语法“decorators-legacy”的支持 - Support for the experimental syntax 'decorators-legacy' isn't currently enabled in React Native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM