Migrating Rails 6 applications from webpacker to importmaps

Rails 7 will no longer ship with webpacker by default but will instead use importmaps. This is a much lighter solution for applications which mostly rely on external scripts. This post explains how to migrate an existing application from webpacker to importmaps. Installation Remove the webpacker gem from your Gemfile and add the importmap-rails gem instead. Next, remove the javascript_pack_tag line from your application layout in app/views/layouts/application.html.erb. To set everything up, run the importmap installer with the command ....

October 14, 2021 · Codefabrik GmbH