Reading Time: 2 minutes
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.
What are current problems?
There are a few problems Ruby on Rails developers cope with.
Let’s have a look at them:
- 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/.
- The issue of dependencies between frontend libraries is not solved. This means that one can accidentally put 2 incompatible versions and cause plenty trouble.
- 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 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?