Registry / devops / vite-console-forward-plugin

vite-console-forward-plugin

JSON →
library2.0.1jsnpmunverified

A Vite plugin that forwards browser console logs (console.log, console.warn, console.error, etc.) to the Vite dev server console. v2.0.1 is the latest stable release, requiring Vite ^6.0.0 || ^7.0.0. Released as a single-file TypeScript plugin under MIT. Differentiates from similar tools by being a minimal, no-dependency Vite plugin with configurable endpoints and log levels, and automatic buffering. Useful for debugging in environments where browser dev tools are inaccessible, such as mobile devices or CI pipelines.

npm install vite-console-forward-plugin
INSTALL
IMPORT
SIG · VITE-CONSOLE-FORWA
V
vite-console-forward-plugin
devopsjavascriptv2.0.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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

consoleForwardPlugin
import { consoleForwardPlugin } from 'vite-console-forward-plugin'
import consoleForwardPlugin from 'vite-console-forward-plugin'
The package exports a named function, not a default export. Use named import.
ConsoleForwardOptions
import type { ConsoleForwardOptions } from 'vite-console-forward-plugin'
TypeScript users should import the options type for proper typing.

Configures the plugin in vite.config.ts with enabled toggle, custom endpoint, and forwarded log levels.

import { defineConfig } from 'vite'; import { consoleForwardPlugin } from 'vite-console-forward-plugin'; export default defineConfig({ plugins: [ consoleForwardPlugin({ enabled: process.env.NODE_ENV === 'development', endpoint: '/api/debug/client-logs', levels: ['log', 'warn', 'error', 'info', 'debug'] }) ], server: { port: 5173 } });
Debug
Known issues
breakingv2.0.0 dropped support for Vite 5. Plugins using Vite 5 must stay on v1.x.
fix
Use vite-console-forward-plugin@1.0.0 if using Vite 5.
affects: >=2.0.0
gotchaThe endpoint must not conflict with other routes in your Vite project, as the plugin adds a middleware that intercepts POST requests to that path.
fix
Use a unique endpoint path (e.g. '/__console_logs__') to avoid conflicts.
affects: >=1.0.0
gotchaIf the plugin is not enabled, no middleware is registered, but the client-side injection still occurs? Check documentation; injection may still happen even if disabled.
fix
Set `enabled: false` and ensure the plugin is conditionally included only in dev config.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'vite-console-forward-plugin'
Missing installation; package not in node_modules.
fix
npm install vite-console-forward-plugin --save-dev
TypeError: (0 , vite_console_forward_plugin.consoleForwardPlugin) is not a function
Incorrect import style: using default import instead of named import.
fix
Use `import { consoleForwardPlugin } from 'vite-console-forward-plugin'`
Error: Vite plugin 'vite-console-forward-plugin' requires Vite >=6.0.0
Using Vite 5 or older with v2+ of the plugin.
fix
Either downgrade plugin to v1.0.0 or upgrade Vite to ^6.0.0 || ^7.0.0
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies
viterequiredPeer dependency: requires Vite 6 or 7 to run as a plugin
Agent activity
7 hits · last 30 days
node
4
Amazon
1
Resources
vite-console-forward-plugin — npm install vite-console-forward-plugin · libregistry