Madge is introduced

Madge is a developer tool for generating viewable views of module dependencies, finding loop dependencies, and providing you with other useful information. Module dependencies can be extracted to generate a dependency tree.

For example, here is Madge’s own dependency tree:

Usage scenarios:

  • Free your hands and quickly generate dependencies between files in a project. This provides convenience for quickly sorting out the relationship between project files and project optimization.

The installation

npm -g install madge
Copy the code

use

After installing madge globally, go to your project root directory, locate the project entry file index.js, and execute the following command:

madge ./src/index.js
Copy the code

View the terminal print result:

As you can see from the figure, the index.js main entry file relies on two files: app.js and app.css. The dependency files for the app.js file are also printed out, the ones in gray.