rails_vite is a new Vite integration for Rails that works alongside Propshaft without a Rack proxy. It uses a stub file approach: a tiny JS file placed in app/assets/builds/ redirects the browser from Propshaft's world to Vite's dev server, enabling HMR and instant CSS feedback without changing Rails helpers or deploy pipelines. Migrating from jsbundling-rails with esbuild requires only an npm install, a vite.config.ts, and a Procfile update. A full gem mode (rails_vite) is also available for manifest-based asset resolution, modulepreload hints, and CSP nonce support, inspired by Laravel's simpler Vite integration pattern.

10m read timeFrom evilmartians.com
Post cover image
Table of contents
Why Vite?The pledgeInertia.js in Rails: a new era of effortless integrationWhat if Rails doesn’t need to know?The migrationWhat about the gem mode?Vite-lizing Rails: get live reload and hot replacement with Vite RubyNow you know how it’s done

Sort: