{"id":20680,"library":"vite-plugin-ruby","title":"vite-plugin-ruby","description":"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.","status":"active","version":"5.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/ElMassimo/vite_ruby","tags":["javascript","plugin","rails","ruby","vite","vite-plugin","vitejs","typescript"],"install":[{"cmd":"npm install vite-plugin-ruby","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-ruby","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-ruby","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin requires Vite >=5.0.0","package":"vite","optional":false}],"imports":[{"note":"The plugin exports a default function. Named export does not exist. CommonJS require is supported but the default import style is preferred.","wrong":"const { ViteRuby } = require('vite-plugin-ruby')","symbol":"default (ViteRuby)","correct":"import ViteRuby from 'vite-plugin-ruby'"},{"note":"There is no named export 'ViteRuby'; only default export. Using curly braces will result in undefined.","wrong":"import { ViteRuby } from 'vite-plugin-ruby'","symbol":"ViteRuby (named import attempt)","correct":"import ViteRuby from 'vite-plugin-ruby'"},{"note":"If you need the type of the plugin instance, import the default. The package does not export a separate type.","wrong":"import type ViteRuby from 'vite-plugin-ruby'","symbol":"type (TypeScript)","correct":"import ViteRuby from 'vite-plugin-ruby'"}],"quickstart":{"code":"import { defineConfig } from 'vite'\nimport ViteRuby from 'vite-plugin-ruby'\n\nexport default defineConfig({\n  plugins: [\n    ViteRuby(),\n  ],\n})\n","lang":"typescript","description":"Basic setup of vite-plugin-ruby in vite.config.ts. Instantiates the plugin without options, relying on convention-based defaults."},"warnings":[{"fix":"Ensure your config/vite.json has a 'source_code_dir' and 'entry_points' defined, or pass them in the plugin options.","message":"In 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.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Upgrade to Node.js 18 or later.","message":"Support for Node.js 14 and 16 is deprecated as of v5. Future versions may require Node 18+.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Set custom paths in vite.json under 'source_code_dir' and 'entry_points'.","message":"The plugin assumes a specific directory structure (e.g., app/frontend/entrypoints). If your project does not follow the convention, you must configure it explicitly.","severity":"gotcha","affected_versions":"*"},{"fix":"Follow the setup guide of vite_ruby to add the ViteRuby middleware in your Rails config.","message":"HMR 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.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install vite-plugin-ruby or yarn add vite-plugin-ruby.","cause":"The package is not installed or the path is incorrect.","error":"Error: Cannot find module 'vite-plugin-ruby'"},{"fix":"Change to: import ViteRuby from 'vite-plugin-ruby'","cause":"Attempting named import instead of default import.","error":"export 'ViteRuby' (imported as 'ViteRuby') was not found in 'vite-plugin-ruby'"},{"fix":"Ensure you import the default and call it as a function: import ViteRuby from 'vite-plugin-ruby'; ViteRuby()","cause":"Accidentally imported the default as an object or used wrong import style.","error":"TypeError: ViteRuby is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}