Registry / web-framework / vite-plugin-ruby

vite-plugin-ruby

JSON →
library5.2.1jsnpmunverified

A Vite plugin that provides convention-over-configuration integration for Ruby projects, primarily used with Rails, Hanami, or plain Ruby via the vite_ruby gem. Current stable version is 5.2.1. It is updated regularly alongside the vite_ruby ecosystem. Unlike generic Vite setups, it auto-discovers entry points, handles asset paths, and bridges Vite's HMR with Ruby development servers. Ships TypeScript types. Requires Vite >=5.0.0.

npm install vite-plugin-ruby
INSTALL
IMPORT
SIG · VITE-PLUGIN-RUBY
V
vite-plugin-ruby
web-frameworkjavascriptv5.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (ViteRuby)
import ViteRuby from 'vite-plugin-ruby'
const { ViteRuby } = require('vite-plugin-ruby')
The plugin exports a default function. Named export does not exist. CommonJS require is supported but the default import style is preferred.
ViteRuby (named import attempt)
import ViteRuby from 'vite-plugin-ruby'
import { ViteRuby } from 'vite-plugin-ruby'
There is no named export 'ViteRuby'; only default export. Using curly braces will result in undefined.
type (TypeScript)
import ViteRuby from 'vite-plugin-ruby'
import type ViteRuby from 'vite-plugin-ruby'
If you need the type of the plugin instance, import the default. The package does not export a separate type.

Basic setup of vite-plugin-ruby in vite.config.ts. Instantiates the plugin without options, relying on convention-based defaults.

import { defineConfig } from 'vite' import ViteRuby from 'vite-plugin-ruby' export default defineConfig({ plugins: [ ViteRuby(), ], })
Debug
Known issues
breakingIn v5, the plugin no longer automatically resolves the entry point from config/vite.json if missing; you must explicitly define entry points in vite.json or via plugin options.
fix
Ensure your config/vite.json has a 'source_code_dir' and 'entry_points' defined, or pass them in the plugin options.
affects: >=5.0.0
deprecatedSupport for Node.js 14 and 16 is deprecated as of v5. Future versions may require Node 18+.
fix
Upgrade to Node.js 18 or later.
affects: >=5.0.0
gotchaThe plugin assumes a specific directory structure (e.g., app/frontend/entrypoints). If your project does not follow the convention, you must configure it explicitly.
fix
Set custom paths in vite.json under 'source_code_dir' and 'entry_points'.
affects: *
gotchaHMR may not work correctly if the Ruby server (e.g., Rails) is not configured to proxy Vite's WebSocket. The vite_ruby gem must be properly set up.
fix
Follow the setup guide of vite_ruby to add the ViteRuby middleware in your Rails config.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'vite-plugin-ruby'
The package is not installed or the path is incorrect.
fix
Run npm install vite-plugin-ruby or yarn add vite-plugin-ruby.
export 'ViteRuby' (imported as 'ViteRuby') was not found in 'vite-plugin-ruby'
Attempting named import instead of default import.
fix
Change to: import ViteRuby from 'vite-plugin-ruby'
TypeError: ViteRuby is not a function
Accidentally imported the default as an object or used wrong import style.
fix
Ensure you import the default and call it as a function: import ViteRuby from 'vite-plugin-ruby'; ViteRuby()
Upgrade
Version history
5.2.1latest on npm
Audit
Dependencies
viterequiredpeer dependency; plugin requires Vite >=5.0.0
Agent activity
38 hits · last 30 days
node
34
OpenAI (training)
1
Resources
vite-plugin-ruby — npm install vite-plugin-ruby · libregistry