Now that webpacker is removed from rails 7 which javascript library can I use without it

Webpacker has to be added for react support, and i’m planning on using react, but that doesn’t mean I have to have jsx files in my app, they can just be js What confusion I thought rails was moving towards react integration, now they’ve removed webpacker but say you still have to use it if you wanna use react

Use jsbudling-rails with webpack.

1 Like

“webpacker” now has much more active development from React enthusiasts here:

Shakapacker v6 is much better than Webpacker v5 and prior.

You can see a more updated comparison here:

@brenogazzola why do you think that jsbundling-rails would be superior for using webpack with React and Rails?

Webpacker is an opinionated gem that tries to hide Webpack behind rails conventions and a XML configuration file. It was made to set good defaults for a Rails project that does render HTML in the server, bundles CSS with sprockets, and JS with webpack. It works very well for that and I used it in my own projects for Rails 6.0 and 6.1.

But if you are going API only rails with React as your front, I’m guessing you are more heavily invested in the JS environment and probably need to do things in a different way than Webpacker does. In this case, it’s probably a good idea to go with jsbundling-rails since it’s just a thin layer around the bundler of your choice (webpack, esbuild), and let’s you mess with the configuration file for the bundler directly. Which means that the majority of tutorials available online will work for you, as will the bundler’s own documentation.

That said, my knowledge is limited to Webpacker up to V5. I don’t know what changes are available in V6/Shakapaker, so the equation might have changed.

I’ve been checking Shakapaker and it seems it’s specifically targeted to React + Rails? If it’s so, than Shakapaker should be better option when compared to jsbundling.

2 Likes

I don’t like jsbundling-rails and cssbundling-rails, but i like GitHub - shakacode/shakapacker: Use Webpack to manage app-like JavaScript modules in Rails

1 Like