Symfony/React Solving Problems with Babel

Asked

Viewed 38 times

3

I’m new to Symfony/React and soon I come across the following problem...

I cannot execute the same commands that I find in some tutorials (Destined to React) on the Web, so I understood the "plugin" referred to in the error message if it is due to the lack of the Plugin of the same name (plugin-Proposal-class-properties) which even cite link with the specific command for the installation of the same.

Add @Babel/plugin-Proposal-class-properties (https://git.io/vb4SL) to the 'plugins' Section of your Babel config to enable Transformation.

Obviously I tried to install it both through the NPM command and YARN but the same error continues as if there were no changes; the temporary solution found was to remove the with the new nameserve (Arrown Function)

Searching in google falls in other responses through Stackoverflow in English to which suggested insertion of the file .babelrc or also through the archive Babel.config.js I tried both ways and once again, nothing done.

I came to the conclusion that the version perhaps of Webpack/Encore used by Symfony to manage React is not ready to receive these "news" that are still under test; what confirms this suspicion is the message in the documentation of React itself written

"Note: this syntax is experimental and not yet standardized."

inserir a descrição da imagem aqui

In any case the error that returns directly in the terminal is something like this:

 20 | handleSubmit = event => {
    |              ^
 21 |     event.preventDefault()
 22 |     alert(JSON.stringify(this.state))
 23 | }

PS: I’m also new here at Stackoverflow

Reference: @Babel/plugin-Proposal-class-properties is Ignored in . babelrc

  • The project you started, has a Babel configuration file or something? Have an example to know the setup of your project?

  • I tried to startar with . babelrc and also without the configuration file With . babelrc I used the default I found on the Babel website

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.