vite-plugin-rails v0.6.0 is a Vite plugin that brings convention over configuration to Rails projects, bundling several commonly needed plugins (Ruby integration, gzip/brotli compression, environment variable exposure, full reload on template changes, Stimulus HMR, and SRI manifest hashing) with zero-config defaults while remaining fully configurable. Unlike the minimal vite-plugin-ruby, this plugin provides an opinionated, batteries-included setup for Rails developers. Released under MIT license, maintained by ElMassimo as part of the vite_ruby ecosystem. Requires Vite >=5.0.0.
npm install vite-plugin-railsVerified import paths — ran on the pinned version, not inferred.
Registers the plugin with Vite config, showing optional compression, environment variables, full reload paths, and Stimulus HMR configuration.
Replace import from 'vite-plugin-ruby' to 'vite-plugin-rails'; adjust options to match the new config shape.
Update Vite to version 5.0.0 or higher.
Refer to the latest src/index.ts for valid options.
Use plugin options to configure bundled plugins; pass `compress: false` to disable completely.
Set `fullReload: { additionalPaths: [] }` or configure to match your exact template patterns.Run `npm install vite-plugin-rails --save-dev` (or yarn) and ensure package.json includes it.
Upgrade Vite to version 5.0.0 or newer.
Ensure options object is properly formatted; for example, set `compress: { gzip: true, brotli: false }`.Ensure build is run with the plugin; check if `vite build` completes and manifest.json is produced.
Switch to `import ViteRails from 'vite-plugin-rails'` and ensure your project uses ESM (type: module in package.json).