Frontend management is a great time-eater for any full stack Ruby on Rails developer. Luckily, now there’s a gem, which is ready to become your little (or big) helper with these issues. Check details about Webpacker inside!

What is the issue?

A long time ago during Ruby on Rails 3.1 release assets-pipeline was introduced.

At that time it was a pretty innovative thing, which allowed developers managing all their javascript/css/images and organizing them in a meaningful way. Since then a lot of water has passed under the bridge and frontend development has also changed a lot. Previously JQuery and Mootools were on the edge, which means plenty frameworks, including Angular and React. But this is not the case anymore and as time passed, the issue started requiring a new solution.

What are current problems?

There are a few problems Ruby on Rails developers cope with.

Let’s have a look at them:

  1. All side libraries need to be added from gems. It is quite common that there they are of not the latest version, which is bad. Otherwise, one has to do it manually by putting to vendor/.
  2. The issue of dependencies between frontend libraries is not solved. This means that one can accidentally put 2 incompatible versions and cause plenty trouble.
  3. Though currently, the majority of developers is using bower-rails to solve first two issues, it is still not the perfect solution. It is really slow, which will definitely get on your nerves, especially if you are working with a big project. The problem here is with its ideology: JS failed are compiled into one or a few files and pushed together to the server. As soon as http/2 arrives, this wouldn’t work anymore.

What is the solution?

Webpacker is the answer. ruby_header Ruby on Rails developers got tired of these issues and developed Webpacker library, which works perfectly with assets-pipeline. In fact, this is a wrapper for Webpack library, which is currently the best existing bundler for a frontend. Developers promise that it will work out of box and will solve all the major issues here. Webpacker works with Rails 5.1+, uses Yarn dependency, is easy to configure and works just perfect. It goes ready for React, which will also save Ruby on Rails developers plenty of time.

Of course, Webpacker yet has some way to go. But it is already a pretty powerful tool, which will make your life as a developer much easier. So why not give it a shot?

How useful was this post?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 8

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


Daria Stolyar is a Marketing Manager at Rubyroid Labs. You can follow her at Linkedin.

Write A Comment