Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@babel/plugin-proposal-class-properties does not work with CRA 2.0

See original GitHub issue

Install react-scripts@2.0.0-next.3e165448 and use a package with classProperties, for example @material/react-top-app-bar, you will get this error:

 Support for the experimental syntax 'classProperties' isn't currently enabled
Add @babel/plugin-proposal-class-properties ( to the 'plugins' section of your Babel config to enable transformation.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

gaearoncommented, Jun 19, 2018

folks at Google feel like the experimental ES features are here to stay

I think this might be a misunderstanding of some sort. I was physically present at a TC39 meeting just a few months ago, and I can assure you the current behavior or syntax of class properties was not by any means considered final.

I understand that CRA is trying to be highly opinionated, but some of these opinions seems to fall out of the scope of React itself. In my opinion, CRA should be be opinionated in the relevant scope, and not try to babysit its users when it comes to making decisions outside of that scope.

Respectfully, I understand your position, but the vast majority of the users of this library won’t know what they’re getting into (just like you didn’t). If the spec changes in half a year, and all of the code published using it will stop compiling in the next version of CRA that updates Babel, people will blame React and the React ecosystem for the churn.

And in a way, they’ll be right. Compiling third-party code with transforms specified by the app tooling is very fragile, as proven by years of watching frustrated React Native users (who adopted this approach and regretted it quite a few times). And beginners (who might not know how to run a codemod, or what to do when we break their code) will be hurt the most. Given that CRA’s goal is to make React easy to get started with, this seems like it a direct contradiction to its mission.

Being the only official project in the React ecosystem related to build tooling, I see it as our responsibility to try to ensure our users don’t shoot themselves in the foot, even if at the time they think it’s best for them.

bidanjuncommented, Oct 4, 2018

as a example,for react-navigation,it’s published as source code in npm. it use react-navigation-deprecated-tab-navigator, also it’s publish using source code without compile,so ./node_modules/react-navigation-deprecated-tab-navigator/src/views/TabBarBottom.js SyntaxError: D:.…\node_modules\react-navigation-deprecated-tab-navigator\src\views\TabBarBottom.js: Support for the experimental syntax ‘classProperties’ isn’t currently enabled (26:23):

and is there any way to use it without eject?

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/plugin-proposal-class-properties not being picked up ...
I am trying to incorporate React Native Calendars into my React webapp. I have run npm install --save react-native-calendars.
Read more >
Below is a class with four class properties which will be transformed. class Bork { //Property initializer syntax instanceProperty = "bork"; boundFunction =...
Read more >
support for the experimental syntax 'decorators-legacy' isn't ...
I had the same problem, but I was able to get it working by running npm install --save-dev @babel/plugin-proposal-decorators and adding ...
Read more >
How to get MobX Decorators to work with Create-React-App v2?
You don't have to use more packages, or change configurations. 1- Use decorate in stores – for observable, computed : import { observable,...
Read more >
Customizing Сreate React App without Eject - 2muchcoffee
Here are simple steps of the project fork for customizing a CRA without Eject. ... @babel/plugin-proposal-class-properties.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found