Sign In | Sign Up



ruby

Step-by-Step guide on how to move from Sprockets to Webpacker

by Kevin

Why we write this guide  There are several reasons The official guide provides very little info. We underestimated the effort to do this. This long post explains our similar experience. Yet, that long post doesn't give a brief step-by-step guide. So, we decide to fill the gap.             1. Add Webpacker to Gemfile  We recommend you to leave the sprockets gem in your Gemfile if it's still needed. Or, if you plan to move gradually. Don't worry because both of them won't interfere with each other.  In our project, we do use both because we can't migrate all the javascript libs we use for various reasons we can't disclose.      At the last of this step, make sure you've run the bundle install command.      2. Configure the webpacker gem  There are many configurations on the webpacker documentation. Here, we'll focus on these three, to make you easier to start: config/webpack/loader/custom_loader.js config/webpack/loader/erb.js config/webpack/production.js Let's start with custom_loader.js. In this file, we use…
Score: 1.32
07/17/2020

Privacy settings changed!

Article is saved. Do you want to continue editing the article or leave and edit later?

Not logged in, Please login to continue

Location: United States (en)
  • United States (us)
  • 日本 (jp)
  • Indonesia (id)
  • India (in)
Terms and Conditions | Privacy Policy | About Us
FAQ | Contact Us
 
© 2025 123ish