Registry / devops / vite-plugin-eruda

vite-plugin-eruda

JSON →
library1.0.1jsnpmunverified

A Vite plugin that automatically loads the Eruda mobile debugging console in development mode. Version 1.0.1 is the latest stable release. It simplifies integration by conditionally injecting Eruda based on the environment (NODE_ENV or a 'debug' option). Unlike manual Eruda setup, this plugin handles ESM imports and Vite configuration seamlessly. Ships TypeScript types. Low maintenance; simple API with one main export.

npm install vite-plugin-eruda
INSTALL
IMPORT
SIG · VITE-PLUGIN-ERUDA
V
vite-plugin-eruda
devopsjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

eruda
✓ import eruda from 'vite-plugin-eruda'
✗ import { eruda } from 'vite-plugin-eruda'
This plugin uses a default export.
vite-plugin-eruda
✓ const eruda = require('vite-plugin-eruda')
✗ const { eruda } = require('vite-plugin-eruda')
In CommonJS, require the default export.
vite-plugin-eruda types
✓ // types are included
✗ import type { Options } from 'vite-plugin-eruda'
Types are bundled; Options is not exported. Use default import for type inference.

Shows how to register the plugin in Vite config to automatically load Eruda in development.

// vite.config.js import { defineConfig } from 'vite'; import eruda from 'vite-plugin-eruda'; export default defineConfig({ plugins: [ eruda() ] });
Debug
Known issues
gotchaThe 'debug' option defaults to undefined, meaning process.env.NODE_ENV !== 'production' is used. If you set it to false, Eruda will not load even in development.
fix
Set 'debug' to true explicitly to force loading, or omit it for default behavior.
affects: >=1.0.0
gotchaEruda is loaded asynchronously; the plugin does not wait for it to be ready. If you need to configure Eruda before it loads, you must do it outside the plugin.
fix
Use a custom script to dynamically import eruda and configure it before calling eruda.init().
affects: >=1.0.0
gotchaThe plugin only injects Eruda in the browser; it does not work in Node.js SSR contexts.
fix
Ensure the plugin is only applied in client-side builds (e.g., using ssr: false in vite config).
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'vite-plugin-eruda'
Package not installed or incorrect import path.
fix
Run 'npm install vite-plugin-eruda' or 'yarn add vite-plugin-eruda'.
Uncaught TypeError: eruda is not a function
Incorrect import syntax (named import instead of default).
fix
Use 'import eruda from 'vite-plugin-eruda'' instead of '{ eruda }'.
Eruda not appearing on mobile device
The plugin only loads in development; production builds skip it. Also ensure the debug option is not set to false.
fix
Run 'vite' (dev server) and access the page from a mobile device. If still missing, check browser console for errors.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
erudarequiredProvides the actual debugging toolkit injected by the plugin
Agent activity
8 hits · last 30 days
node
8
Resources
vite-plugin-eruda — npm install vite-plugin-eruda · libregistry