importmap-rails
Ruby gem that adds import maps to Rails so JavaScript ES modules load in the browser without transpiling or bundling.
importmap-rails is a Ruby gem that adds import maps to Rails, so the browser loads JavaScript ES modules directly. The application’s config/importmap.rb pins logical module names to local files or CDN URLs, and the layout helper javascript_importmap_tags writes the map into the page. The ./bin/importmap command downloads npm packages from a CDN into vendor/javascript, where they are served by the asset pipeline.
The README presents this as an approach that avoids transpiling and bundling, so an application ships many small files instead of one bundle. Rails 7 and later include the gem by default in new applications.
Worth knowing
Subresource integrity is opt-in: the gem adds hashes only after enable_integrity! is called in the importmap configuration, and Propshaft needs an integrity algorithm set in the application.
Identity
Rendering and deploy
- Install with
- bundler, then rails generator importmap:install2
Releases
Adoption
Sources
- 2026-10-28: links, Written in, Categories, GitHub stars
api.github.com/repos/rails/importmap-rails - 2026-10-28: links, Built on, Install with
github.com/rails/importmap-rails/blob/v2.2.3/README.md - 2026-10-28: Maintainer, License model
github.com/rails/importmap-rails/blob/v2.2.3/MIT-LICENSE - 2026-10-28: Runtime, Minimum runtime, License
github.com/rails/importmap-rails/blob/v2.2.3/importmap-rails.gemspec - 2026-10-28: First release
rubygems.org/api/v1/versions/importmap-rails.json - 2026-10-28: Current major version, Last release
rubygems.org/api/v1/gems/importmap-rails.json - 2026-10-28: Contributors
api.github.com/repos/rails/importmap-rails/contributors - 2026-10-28: Dependent packages, Dependent repositories
packages.ecosyste.ms/api/v1/registries/rubygems.org/packages/importmap-rails