rollup-plugin-dep-graph
v1.0.1
Published
A Rollup plugin that generates a dependency graph of your bundle.
Downloads
3
Readme
This plugin uses the graphlib library to create a directed graph to store the dependencies between modules. The plugin hooks into several Rollup events to populate the graph and print it at the end of the build process. Here's how it works:
In the buildStart hook, the plugin clears the graph to ensure that it starts with a clean slate for each build. In the resolveId hook, the plugin adds a new node to the graph for each module that Rollup encounters. The resolveId hook is called when Rollup is looking for a module's ID, so this is a good place to add the node to the graph. In the load hook, the plugin adds edges to the graph for each imported module. The load hook is called when Rollup is loading a module, so this is a good place to add edges to the graph for each imported module. Finally, in the generateBundle hook, the plugin prints the graph to the console. This hook is called after Rollup has finished generating the bundle, so this is a good place to print the graph. To use this plugin, simply import it into your Rollup config file and add it to your plugins list:
js
import printDependencyGraph from 'rollup-plugin-dep-graph';
export default {
plugins: [
printDependencyGraph()
]
};