@babel/plugin-proposal-class-properties does not work with CRA 2.0
See original GitHub issueInstall 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 (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:10 (5 by maintainers)
Top 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 >babel/plugin-proposal-class-properties
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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.
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?