npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-terminal-error-logger

v0.1.1

Published

A universal Vite plugin to log browser runtime errors to the Vite terminal with sourcemap and Error Overlay support.

Readme

vite-terminal-error-logger

A universal Vite plugin that captures browser runtime try-catch errors and seamlessly logs them to the local terminal, featuring full Sourcemap path restoration and full-screen Error Overlay triggers in development.

简体中文

Features

  • 🎯 Runtime Error Sync: Catch business/protocol initialization errors in browser and view them right in your Vite terminal.
  • 🗺️ Accurate Sourcemap: Automatically maps compiled lines/columns back to your original .ts source files.
  • Vite Error Overlay: Intercepts errors and forces Vite's official full-screen red error box to show up, halting dangerous user interactions during development.
  • 🪓 Zero Prod Footprint: Tied with import.meta.hot, meaning all debugging overhead is completely tree-shaken during vite build.

Installation

npm install vite-terminal-error-logger -D
# or with pnpm
pnpm add vite-terminal-error-logger -D

Usage

1. Configure Plugin in vite.config.ts

import { defineConfig } from "vite";
import { terminalErrorLogger } from "vite-terminal-error-logger";

export default defineConfig({
  plugins: [
    terminalErrorLogger({
      event: "app:check-error", // Custom HMR event name
      prefix: "protocol",       // Terminal log prefix inside [ ]
      title: "Definition Error" // Log title
    })
  ]
});

2. Capture and Send in Frontend (App.vue or Initialization Scripts)

Wrap your initialization checkers or boundary handlers:

import { ref } from "vue";

const isDevError = ref(false);

async function runCheckers() {
  try {
    // Your custom hardware protocol or business validation logic
    await validateUSBDevice(); 
  } catch (e) {
    console.error(e); // Optional fallback

    if (import.meta.hot) {
      const err = e instanceof Error ? e : new Error(String(e));
      
      // 1. Physically unmount business views to prevent further user interactions
      isDevError.value = true;
      
      // 2. Dispatch to Vite plugin via HMR WS
      import.meta.hot.send("app:check-error", {
        message: err.message,
        stack: err.stack ?? ""
      });
    }
  }
}

Options

| Property | Type | Default | Description | | ----------- | --------- | ------------------ | ------------------------------------------------------------------------------------------------ | | event | string | "terminal-error" | Custom HMR WebSocket event name. | | prefix | string | "error" | Log prefix enclosed in [ ] both in terminal and overlay header. | | title | string | "Runtime error" | Header description for the error context. | | sourcemap | boolean | true | Whether to reverse-map browser stacks back to original .ts source code via Vite's moduleGraph. |

License

MIT