In order to use ES Class Fields & Static Properties.
Here is my environment
react-rails-1.3.1
babel-transpiler-0.7.0
application.rb sets
config.react.jsx_transform_options = {
plugins: ['transform-class-properties']
}
got an error message ReferenceError: Unknown plugin "transform-class-properties". What's wrong here? Thanks.
Installing the plugin via npm solved the problem for me:
npm install babel-plugin-transform-class-properties --save
I'll try it. Thanks.
absolutely not working for me.
So i have installed
gem "react-rails"
gem 'babel-transpiler', '0.7.0
And i additionally have the plugins i need installed with:
npm install babel-plugin-transform-class-properties --save
So in my Root of my Project i have now a node_modules folder and the package.json.
It is all in place, so which part make actually the reference to the libs? is it the babel-transpiler ?
Ran into this. react-rails 1.x is still running on Babel 5, so there is no point installing babel-plugin-* npm packages nor babel-transpiler explicitly.
Got class properties working with old configuration style:
config.react.jsx_transform_options = {
optional: ['es7.classProperties']
}
This should really be added into the documentation, I'm using react-rails 2.4.6 and @msokk s answer was the only way to get it working
@node-gs Could you please submit a PR with a change to the readme with what you'd like to see? 馃摂
It's always very helpful for us as maintainers to have others contribute the docs because we know how the system works and therefore it's sometimes harder to explain it to a layman.
Most helpful comment
Installing the plugin via npm solved the problem for me: