Laravel + React babel / plugin-proposal-class-properties

时间:2019-06-21 18:31:12

标签: reactjs laravel-5 babel

我已经安装了:

npm install --save-dev @babel/plugin-proposal-class-properties

.babelrc:

{
  "presets": ["@babel/env", "@babel/react"],
  "plugins": [
      "transform-class-properties",
      "transform-object-rest-spread",
      "@babel/plugin-proposal-class-properties"
  ]
}

我在package.json中的依赖项中看到babel类属性:

    "dependencies": {
        "babel-plugin-transform-class-properties": "^6.24.1",

,但是当我尝试使用该组件时:

export default class Header extends React.Component{
    const a = 7;

并运行npm run watch-poll,我得到一个错误:

  

意外令牌   在const行上。

我正在使用Laravel 5.8.19

0 个答案:

没有答案