Giter VIP home page Giter VIP logo

webpack-dep-graph's Introduction

Webpack Dependency Graph Visualizer

Fixed and working.

What is it

  • webpack stats.json parser/converter for visual/UI dependencies analysis
  • configurable filters: exclude, except, include, max deps count
  • output formats:

TODO

Caveats

  • terminology:
    • webpack module: dependencies, source in graph
    • webpack reason(origin): consumer, destination in graph
  • dependency map calculated only for nodes with dependencies. For the dot format it's ok, but for the graphml bunch of nodes added from the dependencies array
  • see the full path in node data properties(right click)
  • search in nodes, urls, properties
  • Exporting one dependency in multiple files can be confusing
  • Graph node label consist of file name only, so if you see similar names, you can right-click it and check the properties-->data tab to see the full path
  • You can enable edge labeling and coloring to check similar dependencies origins

Examples

Generating graphml and editing it in yEd are the best option for now. Best yEd layouts: circular(alt+shift+c), hierarchical(alt+shift+h).

The graphviz layout renderer seems to be less useful. You can upload the simplified dot file into any graphviz editor and try to play with settings.

graphviz

graphml

Used for yed editor

  • graphml: raw xml

  • Manually applied in yed circular layout: tools-->fit node to label, layout-->circular (alt+shift+c)

  • exclude most frequently used dependencies

    	exclude: ["index", "node_modules", "main", "cache", "webpack", "logger", "profile", "config", "platform", "settings", "popup", "confirm", "analytics", "theme", "error",],
    	excludeExcept: [], includeOnlyDestNode: [], includeOnlySrcNode: [],
    	edgeTypeExclude: ["cjs self exports reference","export imported specifier",],
    • summary: imports: 594; dependencies: 123 nodesPaths: 166 nodes: 168
    • graphml
  • include all

    • deps.config.ts
          exclude: [], excludeExcept: [],
          includeOnlyDestNode: [""], includeOnlySrcNode: [""],
          edgeTypeExclude: ["cjs self exports reference","export imported specifier"],
    • summary: imports: 8623; dependencies: 1630 nodesPaths: 2019 nodes: 2021
  • who use @angular/forms dependencies: exclude node_nodules except angular and include only forms source modules

    • filters:
          filters: {
              exclude: ["node_modules"],
              excludeExcept: ["angular"], includeOnlyDestNode: ["key.ts"], includeOnlySrcNode: ["key.ts"],
          //...
          graphml: {
              showSourceEdgeLabels: false,
              showDestEdgeLabels: true,
  • exclude non project files

    • summary: imports: 1654; dependencies: 195 nodesPaths: 224 nodes: 226
    • deps.config.ts
          exclude: ['cache', 'webpack', 'node_modules'],
          excludeExcept: [], includeOnly: [],

What is it for

  • Refactoring decision making helper
  • addition tool for the code analysis methodic
  • Detect a circular dependency in a large monorepo project.
  • Figure out where the module is being used, imported and exported from.
  • Analyze why webpack cannot tree-shake a particular module or dependency from the chunk.

How to run

  • set the config params
  • optionally use node version manager to choose node@16+
  • execute in console
        nvm i 16 # optionally
        npm i
        cp ${your_project_folder}/stats.json ./webpack-dep-graph/webpack-stats.json
        npm run start
        

Similar projects

  • deps graph with npm and vscode plugin
  • deps diff with query language statoscope
  • without webpack stats.json repo
  • forked from: unmaintained broken draft repo
  • Unmaintained repo
  • Unmaintained repo

webpack-dep-graph's People

Contributors

bskydive avatar heypoom avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.