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-chunk-cycle-detector

v1.0.0

Published

Vite 插件,用于检测 chunk 之间的循环依赖并输出详细依赖路径

Readme

vite-plugin-chunk-cycle-detector

Vite插件,用于检测构建产物中chunk之间的循环依赖,并输出详细的依赖路径信息。

功能特性

  • 精准检测chunk级循环依赖:基于Kahn算法识别循环依赖的chunk集合
  • 详细路径展示:通过DFS提取所有简单环路径,直观展示循环链路
  • 可配置错误抛出:支持在检测到循环时中断构建(通过circleImportThrowError配置)
  • 模块级依赖详情:可选展示具体模块间的引用关系(通过showCircleImportModuleDetail配置)

安装

# npm
npm install vite-plugin-chunk-cycle-detector -D

# pnpm
pnpm add vite-plugin-chunk-cycle-detector -D

# yarn
yarn add vite-plugin-chunk-cycle-detector -D

使用示例

vite.config.ts中配置插件:

import { defineConfig } from 'vite'
import chunkCycleDetectorPlugin from 'vite-plugin-chunk-cycle-detector'

export default defineConfig({ 
  plugins: [
    chunkCycleDetectorPlugin({ 
      circleImportThrowError: true, // 检测到循环时抛出错误中断构建
      showCircleImportModuleDetail: true // 显示具体模块间的依赖关系
    })
  ]
}) 

配置选项

| 选项名 | 类型 | 默认值 | 说明 | |---------------------------|-----------|---------|--------------------------------------------------------------------| | circleImportThrowError | boolean | false | 是否在检测到循环依赖时抛出错误(会中断构建流程) | | showCircleImportModuleDetail | boolean | false | 是否显示循环路径中具体模块间的引用关系(如chunkA中的module1引用了chunkB中的module2) |

输出示例

⚠️ 检测到 2 个 chunk 间的循环依赖:

  🔄 循环1: chunkA → chunkB → chunkA
     chunkA 中的模块 src/a.js 引用了 chunkB 中的模块 src/b.js
     chunkB 中的模块 src/b.js 引用了 chunkA 中的模块 src/a.js

  🔄 循环2: chunkC → chunkD → chunkC
     chunkC 中的模块 src/c.js 引用了 chunkD 中的模块 src/d.js
     chunkD 中的模块 src/d.js 引用了 chunkC 中的模块 src/c.js

许可证

MIT