Performance: Import maps (Rails 7+)
MEDIUM IMPACT
Import maps affect page load speed by controlling how JavaScript modules are loaded and resolved in the browser without bundling.
importmap pin "example", to: "example.js" // Browser loads modules on demand using import maps without bundling
import { example } from './example.js'; // Using a traditional bundler that creates a large single bundle loaded on page start
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Bundled JavaScript | Minimal DOM impact | 0-1 reflows | High paint cost due to blocking scripts | [X] Bad |
| Import maps with on-demand modules | Minimal DOM impact | 0 reflows | Lower paint cost, scripts load asynchronously | [OK] Good |