
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@browser-echo/vite
Advanced tools
Vite plugin for streaming browser console logs to your dev terminal with colors, stack traces, and optional file logging.
Vite plugin for streaming browser console logs to your dev terminal with colors, stack traces, and optional file logging.
This package provides a Vite plugin that includes dev middleware and a virtual module to forward browser console logs to your terminal during development. Works with React, Vue, TanStack Start, and any Vite-based project.
index.html or server-side rendered appsnpm install -D @browser-echo/vite
# or
pnpm add -D @browser-echo/vite
npm install -D @browser-echo/vite
# or
pnpm add -D @browser-echo/vite
// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import browserEcho from '@browser-echo/vite';
export default defineConfig({
plugins: [
vue(),
browserEcho({
// Optional configuration
stackMode: 'condensed',
colors: true,
}),
],
});
That's it! Your Vue app will now stream console logs to your terminal during development.
npm install -D @browser-echo/vite
# or
pnpm add -D @browser-echo/vite
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import browserEcho from '@browser-echo/vite';
export default defineConfig({
plugins: [
react(),
browserEcho({
// Optional configuration
stackMode: 'condensed',
colors: true,
}),
],
});
Your React app will now stream console logs to your terminal during development.
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import browserEcho from '@browser-echo/vite';
export default defineConfig({
plugins: [
react(),
browserEcho({
injectHtml: false, // Important: TanStack Start doesn't use index.html
stackMode: 'condensed',
fileLog: { enabled: true },
}),
],
});
Important for TanStack Start: Since TanStack Start renders without an index.html, you need to set injectHtml: false and import the virtual module manually in your router:
// src/router.tsx
if (import.meta.env.DEV && typeof window !== 'undefined') {
void import('virtual:browser-echo');
}
interface BrowserEchoViteOptions {
enabled?: boolean; // default: true (dev only)
route?: `/${string}`; // default: '/__client-logs'
include?: BrowserLogLevel[]; // default: ['log','info','warn','error','debug']
preserveConsole?: boolean; // default: true
tag?: string; // default: '[browser]'
colors?: boolean; // default: true
injectHtml?: boolean; // default: true
stackMode?: 'none' | 'condensed' | 'full'; // default: 'condensed'
showSource?: boolean; // default: true
batch?: { size?: number; interval?: number }; // default: 20 / 300ms
truncate?: number; // default: 10_000 chars
fileLog?: { enabled?: boolean; dir?: string }; // default: disabled
mcp?: {
url?: string; // MCP server base URL (auto-discovered if not set)
routeLogs?: `/${string}`; // MCP logs route (default: '/__client-logs')
suppressTerminal?: boolean; // Suppress terminal output when forwarding (default: auto)
headers?: Record<string,string>; // Custom headers for MCP requests
};
discoverMcp?: boolean; // Enable MCP auto-discovery (default: true)
discoveryRefreshMs?: number; // Discovery refresh interval (default: 30000)
}
The Vite plugin automatically discovers and forwards logs to MCP servers. No configuration needed in most cases!
📖 First, set up the MCP server for your AI assistant, then configure framework options below.
browserEcho({
// MCP auto-discovery enabled by default
// Logs forward to MCP when detected, terminal output suppressed
})
browserEcho({
mcp: {
url: 'http://127.0.0.1:5179', // Explicit MCP base URL
suppressTerminal: false, // Keep terminal output even when forwarding
headers: { 'Authorization': 'Bearer ...' } // Custom headers if needed
}
})
browserEcho({
discoverMcp: false, // Disable auto-discovery
mcp: { url: '' } // Disable explicit MCP
})
BROWSER_ECHO_MCP_URL=http://127.0.0.1:5179/mcp — Set MCP server URLBROWSER_ECHO_SUPPRESS_TERMINAL=1 — Force suppress terminal outputBROWSER_ECHO_SUPPRESS_TERMINAL=0 — Force show terminal outputDiscovery order: BROWSER_ECHO_MCP_URL → port 5179 (dev) → project-local .browser-echo-mcp.json.
Enable optional file logging to write browser logs to disk:
browserEcho({
fileLog: {
enabled: true,
dir: 'logs/frontend' // default: 'logs/frontend'
}
})
The plugin:
/__client-logsvirtual:browser-echo that initializes the clientindex.htmlThis package depends on @browser-echo/core for the client-side functionality.
index.html exists or you import the virtual module manuallyinclude: ['warn','error'] and use stackMode: 'condensed'preserveConsole: falseMIT
FAQs
Vite plugin for streaming browser console logs to your dev terminal with colors, stack traces, and optional file logging.
The npm package @browser-echo/vite receives a total of 513 weekly downloads. As such, @browser-echo/vite popularity was classified as not popular.
We found that @browser-echo/vite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.