reactjs/react-rails

Upgrade docs to refer to Shakapacker

justin808 opened this issue · 1 comments

https://github.com/reactjs/react-rails#3-now-run-the-installers doc refers to webpacker.

Let's update this.

Assigned: @ahangarha

I worked on this issue for a couple of days. I tried different scenarios and found two issues:

  1. I have realized there is an issue with config/webpacker.yml file generated by shakapacker. The value for source_entry_path is set to / which is taken as an absolute path by Ruby Pathname and as a result, react-rails install script tries to copy files to the root of filesystem. This can be fixed either by manually replacing / with ., or add some automation for overriding webpacker.yml file, or fix the issue right in the shakapacker project. I think this was a bug but never seen because no project uses / for that entry.
  2. For react-rails we need to install prop-types as well. We need to add this step in installing react and related packages before running rails g react:install.

With these two changes, I could install the project on both Rails 6 and Rails 7.