When I was learning about integrating ROR backend API with React frontend, I came across a flag introduced in Rails 5.1 which is:
--webpack=react