babel: after adding @babel/plugin-proposal-class-properties in same error
Bug Report
Current Behavior currently showing
Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the ‘plugins’ section of your Babel config to enable transformation.
when I add @babel/plugin-proposal-class-properties
in node_modules, .babelrc plugins no effect, same message shows
Input Code
- REPL or Repo link if applicable:
package.json
.babelrc
` please help
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 20 (3 by maintainers)
Commits related to this issue
- Fix @babel/plugin-proposal-class-properties error https://github.com/babel/babel/issues/8577#issuecomment-544026690 — committed to haruelrovix/tinder-react-native by haruelrovix 5 years ago
If you are using create-react-app and have ejected, add this as your babel config (in package.json):
That means installing
npm install --save-dev @babel/preset-env @babel/preset-react @babel/plugin-proposal-class-properties
You might also have to edit your webpack.config
Source: https://stackoverflow.com/a/52504340/1467941
I get the following error even after adding the plugin:
i confused…
package.json
.babelrc
Working in a large mono-repo had to do three things to get this to work:
package.json
webpack.config.js
.babelrc
What was causing this to not work in our monorepo was not explicitly stating the plugins in the webpack.config.js, even after
yarn add @babel/plugin-proposal-class-properties -D
and adding@babel/plugin-proposal-class-properties
under plugins in.babelrc
webpack babel was still not picking up the presence of the plugin. Only after explicitly stating the plugin in webpack.config.js did the project build (even after rm -rf node_modules, yarn).Base project with this setup is here: https://github.com/buildbreakdo/lambda-starter
Check your
.babelrc
, it’s@babel/plugin-proposal-class-properties
, not@transform-class-properties
The above solution are important. But if it doesn’t fix the issue then this might help you…
If some one working on monorepo following react-native-web-monorepo than you need to
config-overrides.js
file inpackages/web
. you need to addresolveApp('../../node_modules/react-native-ratings'),
in that file…My complete
config-override.js
file isI’m trying to run Jest tests and getting the
Support for the experimental syntax 'classProperties' isn't currently enabled
error due to code innode_modules/react-native/jest/mockComponent.js
.This fixed it for me in
package.json
:Latest recommendations can also be found here: https://jestjs.io/docs/en/tutorial-react-native
I have the same issue. It totally block latest React syntax (static state with no constructor and all arrow functions)
It’s possible these issues step from the changes to config file application. I’d recommend folks take a look at http://babeljs.io/docs/en/config-files#6x-vs-7x-babelrc-loading, which may help.