{"id":22547,"library":"vite-console-forward-plugin","title":"Vite Console Forward Plugin","description":"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.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/mitsuhiko/vite-console-forward-plugin","tags":["javascript","vite","plugin","console","logging","development","debugging","typescript"],"install":[{"cmd":"npm install vite-console-forward-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add vite-console-forward-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-console-forward-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: requires Vite 6 or 7 to run as a plugin","package":"vite","optional":false}],"imports":[{"note":"The package exports a named function, not a default export. Use named import.","wrong":"import consoleForwardPlugin from 'vite-console-forward-plugin'","symbol":"consoleForwardPlugin","correct":"import { consoleForwardPlugin } from 'vite-console-forward-plugin'"},{"note":"TypeScript users should import the options type for proper typing.","symbol":"ConsoleForwardOptions","correct":"import type { ConsoleForwardOptions } from 'vite-console-forward-plugin'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport { consoleForwardPlugin } from 'vite-console-forward-plugin';\n\nexport default defineConfig({\n  plugins: [\n    consoleForwardPlugin({\n      enabled: process.env.NODE_ENV === 'development',\n      endpoint: '/api/debug/client-logs',\n      levels: ['log', 'warn', 'error', 'info', 'debug']\n    })\n  ],\n  server: {\n    port: 5173\n  }\n});","lang":"typescript","description":"Configures the plugin in vite.config.ts with enabled toggle, custom endpoint, and forwarded log levels."},"warnings":[{"fix":"Use vite-console-forward-plugin@1.0.0 if using Vite 5.","message":"v2.0.0 dropped support for Vite 5. Plugins using Vite 5 must stay on v1.x.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use a unique endpoint path (e.g. '/__console_logs__') to avoid conflicts.","message":"The endpoint must not conflict with other routes in your Vite project, as the plugin adds a middleware that intercepts POST requests to that path.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set `enabled: false` and ensure the plugin is conditionally included only in dev config.","message":"If 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'6.0.0':31 '7.0.0':32 'automat':63 'browser':10,71 'buffer':64 'ci':81 'configur':57 'consol':2,11,22,86 'console.error':15 'console.log':13 'console.warn':14 'debug':67,89 'depend':53 'dev':20,72 'develop':88 'devic':79 'differenti':43 'endpoint':58 'environ':69 'etc':16 'file':38 'forward':3,9 'inaccess':75 'javascript':83 'latest':26 'level':61 'log':12,60,87 'minim':50 'mit':42 'mobil':78 'no-depend':51 'pipelin':82 'plugin':4,7,40,55,85 'releas':28,33 'requir':29 'server':21 'similar':45 'singl':37 'single-fil':36 'stabl':27 'tool':46,73 'typescript':39,90 'use':65 'v2.0.1':23 'vite':1,6,19,30,54,84","created_at":"2026-04-27T17:05:45.400261+00:00","updated_at":"2026-04-27T17:05:45.400261+00:00","problems":[{"fix":"npm install vite-console-forward-plugin --save-dev","cause":"Missing installation; package not in node_modules.","error":"Error: Cannot find module 'vite-console-forward-plugin'"},{"fix":"Use `import { consoleForwardPlugin } from 'vite-console-forward-plugin'`","cause":"Incorrect import style: using default import instead of named import.","error":"TypeError: (0 , vite_console_forward_plugin.consoleForwardPlugin) is not a function"},{"fix":"Either downgrade plugin to v1.0.0 or upgrade Vite to ^6.0.0 || ^7.0.0","cause":"Using Vite 5 or older with v2+ of the plugin.","error":"Error: Vite plugin 'vite-console-forward-plugin' requires Vite >=6.0.0"}],"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":null,"github":"https://github.com/mitsuhiko/vite-console-forward-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-console-forward-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}