{"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,"search_vec":"'5.0.0':72 '5.2.1':35 'alongsid':40 'asset':56 'auto':51 'auto-discov':50 'bridg':59 'configur':13 'convent':11 'convention-over-configur':10 'current':31 'develop':65 'discov':52 'ecosystem':44 'entri':53 'gem':30 'generic':46 'hanami':22 'handl':55 'hmr':62 'integr':14 'javascript':73 'path':57 'plain':24 'plugin':3,7,74,80 'point':54 'primarili':18 'project':17 'provid':9 'rail':21,75 'regular':39 'requir':70 'rubi':4,16,25,29,43,64,76 'server':66 'setup':48 'ship':67 'stabl':32 'type':69 'typescript':68,82 'unlik':45 'updat':38 'use':19 'version':33 'via':26 'vite':2,6,28,42,47,60,71,77,79 'vite-plugin':78 'vite-plugin-rubi':1 'vitej':81","created_at":"2026-04-25T11:24:24.589914+00:00","updated_at":"2026-04-25T11:24:24.589914+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://vite-ruby.netlify.app","github":"https://github.com/ElMassimo/vite_ruby","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-ruby","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","devops","type-stubs"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}