Rails no-build stack in version 8: features and trade-offs
Overview
Rails 8 promotes a “no-build” front-end setup for many applications. The approach relies on import maps for JavaScript module loading and Propshaft for asset delivery. It removes the need for Node-based bundlers and transpilers in default setups, while remaining compatible with them when required.
Components
Import maps (importmap-rails): resolve ES module names to digested asset paths or remote URLs directly in the browser; managed via Rails tasks.
Propshaft: default asset pipeline in Rails 8 for new apps; serves static assets with fingerprinting and simple configuration.
Server-first rendering: commonly paired with Hotwire (Turbo/Stimulus) but not required.
Reference: Ruby on Rails Guides
Rationale
Import maps allow modern JavaScript to run without a bundling step by delegating module loading to the browser and mapping module specifiers to versioned files. This reduces build complexity for projects whose JavaScript is modest in size or largely library-driven.
Suitable use cases
- Admin and CRUD interfaces, dashboards, and form-centric workflows where JavaScript is light to moderate.
- Projects prioritizing simple deployments and shorter CI times over advanced bundling optimizations.
When bundlers remain appropriate
- Applications with heavy client-side interactivity (e.g., complex editors) or extensive third-party packages that expect a bundler.
- Codebases that require JSX/TS transforms or advanced tree-shaking. (Rails 8 remains compatible with tools such as esbuild or Vite when needed.)
Incremental migration steps
- Audit current asset setup and JavaScript entry points.
- Enable importmap-rails; pin dependencies; replace bundler entry points with ES module imports.
- Adopt Propshaft where applicable; verify digests and cache headers.
- Keep a scoped bundler only for screens that need transforms or heavy client code.
Operational effects
- Fewer moving parts in CI/CD and simpler local setup for default cases.
- Asset digests and HTTP caching handled by Propshaft; JavaScript fetched as ES modules via import maps.
- Optional integration with Hotwire for incremental page updates.
Relation to prior pipelines
Rails historically used Sprockets; Rails 8 adopts Propshaft by default for new applications. Projects can continue to use or combine alternative pipelines and bundlers as needed.