A Vite plugin that captures browser console.log, console.warn, console.error, unhandled errors, and unhandled promise rejections during development and writes them to timestamped log files on disk. Current stable version is 0.4.0. Published as part of the agent-tail ecosystem, it injects a script via HTML transformation that intercepts console methods, batches output, and sends it to the dev server via sendBeacon. Key differentiators: provides tail -f friendly logs, latest symlink, and integrates with the agent-tail CLI for combined browser+server log viewing. Requires Vite >=5.0.0 and ships TypeScript types.
npm install vite-plugin-agent-tailVerified import paths — ran on the pinned version, not inferred.
Install agent-tail, add the Vite plugin to vite.config.ts, and tail the browser log file.
Update import from 'vite-plugin-agent-tail' to 'agent-tail/vite'.
Use a production logging solution like Sentry or LogRocket for production builds.
Ensure your HTML entry point (index.html) is present and not served externally.
Add 'tmp/logs/' to .gitignore to avoid committing logs, or use a custom log directory.
Update Vite to >=5.0.0: npm install vite@^5.0.0
Use plugins: [agentTail()] instead of plugins: [agentTail].
Install agent-tail: npm install -D agent-tail
Ensure the dev server runs on HTTPS or same-origin. agent-tail attempts to send to the current origin.