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-ai-fixer

v1.0.0

Published

Vite plugin that captures build errors and provides AI-powered solutions

Downloads

134

Readme

vite-plugin-ai-fixer

Vite 构建错误 AI 分析插件。在 vite build 失败时,自动捕获错误并通过 LLM 分析根因,输出解决方案到终端。

特性

  • 🔍 自动捕获构建错误(模块解析失败、TypeScript 错误、CSS 错误等)
  • 📝 读取源文件上下文,提供准确的代码片段
  • 🤖 通过 LLM 分析根因并生成修复方案
  • 🎨 彩色终端输出,清晰直观
  • 🔌 兼容所有 OpenAI 兼容接口

安装

pnpm add -D vite-plugin-ai-fixer

使用

vite.config.ts 中配置:

import { defineConfig } from "vite";
import aiFixer from "vite-plugin-ai-fixer";

export default defineConfig({
    plugins: [
        aiFixer({
            apiKey: "your-api-key", // 必填
            model: "gpt-4o-mini", // 必填
            baseUrl: "https://api.openai.com/v1", // 可选,默认 OpenAI
        }),
    ],
});

使用 Ollama 本地模型

aiFixer({
    apiKey: "ollama",
    model: "qwen2.5-coder",
    baseUrl: "http://localhost:11434/v1",
});

使用 DeepSeek

aiFixer({
    apiKey: "your-deepseek-key",
    model: "deepseek-chat",
    baseUrl: "https://api.deepseek.com/v1",
});

配置项

| 参数 | 类型 | 必填 | 默认值 | 说明 | | -------------- | --------- | ----- | --------------------------- | ---------------- | | apiKey | string | ✅ | - | LLM API Key | | model | string | ✅ | - | 模型名称 | | baseUrl | string | ❌ | https://api.openai.com/v1 | API 地址 | | locale | 'zh-CN' | 'en' | ❌ | zh-CN | | contextLines | number | ❌ | 4 | 代码上下文行数 | | timeout | number | ❌ | 30000 | LLM 调用超时(ms) | | maxErrors | number | ❌ | 10 | 最多分析错误数 | | disable | boolean | ❌ | false | 是否禁用插件 |

输出示例

text
 开始 AI 分析...
 \r✅ AI 分析完成 (9.2s)

🤖 vite-plugin-ai-fixer 分析结果

📄 /Users/fangyan/WorkBuddy/20260416190835/agent-projects-100/projects/test-ai-fixer/src/App.tsx:6:42
🔍 根因 (置信度 100%):
  代码中导入了不存在的包 'non-existent-package',该包未在项目中安装或不存在于 npm 仓库中

💡 解决方案:
  1. 代码修改: 删除对不存在包的导入语句

┌────────────────────────────────────────────┐
│ import reactLogo from './assets/react.svg' │
│ import viteLogo from './assets/vite.svg'   │
│ import heroImg from './assets/hero.png'    │
│ import './App.css'                         │
└────────────────────────────────────────────┘

  2. 执行命令: 如果确实需要该包,请先安装它(但此包名看起来是示例名称)

┌──────────────────────────────────┐
│ npm install non-existent-package │
└──────────────────────────────────┘

📋 总结:
  该错误是由于导入了不存在的 npm 包导致的。最直接的解决方案是删除第6行的导入语句,因为 'non-existent-package' 看起来是一个示例或占位符包名,并非真实存在的依赖。

⏳ Vite 原始错误信息将在 2 秒后显示...