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 🙏

© 2024 – Pkg Stats / Ryan Hefner

circular-dependency-plugin-visualizer

v1.2.3

Published

A tool to help you visualize and understand circular dependencies in your webpack build.

Downloads

14,118

Readme

🔄 Circular Dependency Plugin Visualizer

This package was made for use with the circular-dependency-plugin (GitHub|npm) to assist in making sense of your circular dependencies and aid in fixing them.

Installation

Use a package installer like NPM to install the package and the peer dependency circular-dependency-plugin

npm i --save-dev circular-dependency-plugin circular-dependency-plugin-visualizer

Usage

The visualizer takes all the same options as circular-dependency-plugin >=4.4.0 and an additional optional configuration object specific to the visualization.

// webpack.config.js
const CircularDependencyPlugin = require("circular-dependency-plugin");
const visualizer = require("circular-dependency-plugin-visualizer");

module.exports = {
  entry: "./src/index",
  plugins: [
    new CircularDependencyPlugin(
      visualizer(
        {
          exclude: /node_modules/,
          cwd: process.cwd(),
        },
        {
          filepath: path.join(
            __dirname,
            "circular-dependency-visualization.html"
          ),
        }
      )
    ),
  ],
};

Options

| property | type | default | | -------- | ------ | -------------------------------------------------------------------- | | filepath | string | path.join(process.cwd(), 'circular-dependency-visualization.html') |

Visualzation Notes

Node names

You can hover over a node to show the file path.

Node color

The nodes show different colors for the directory that they're in (up to 10 directories). If because of your directory set up, they are all in the same root directory, like src, try setting the cwd property in the circular-dependency-plugin options to the common root.

// webpack.config.js
const path = require('path');

module.exports = {
  ...,
  plugins: [
    new CircularDependencyPlugin(visualizer({
      ...
      cwd: path.resolve(__dirname, 'src')
    })
  ]
};

Stroke animations

The strokes between nodes are animating in the direction of the import, showing the direction of the dependency chain. If a.js imports b.js, you will see the animation go from the a.js node to the b.js node. This is also the same direction as the arrows from the circular-dependency-plugin.

a.js -> b.js