vendredi 21 juin 2019

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

I have installed it with:

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"
  ]
}

I see babel class properties in dependencies in package.json:

    "dependencies": {
        "babel-plugin-transform-object-rest-spread": "^6.26.0",

, but when I try in the component:

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

and run npm run watch-poll, I am getting an error:

Unexpected token on the const line.

I am using Laravel 5.8.19



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2XkeuAH
via IFTTT

Aucun commentaire:

Enregistrer un commentaire