How to choose plugin hooks about analyze source code dependencies #15493
-
I have a question, please help me. I had ask questions on StackOverflow(https://stackoverflow.com/questions/71389265/webpackhow-to-choose-plugin-hooks-about-analyze-source-code-dependencies) and Gitter, but nobody answer me. Question: I tried code like this
Now I have the flatter array, But I could't take the array to tree. Can anybody help me? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 13 replies
-
if you need some work with ast you need
you should use module graph for that. something like for (const [ name, { dependencies: deps}] of compilation.entries) {
const dep = deps[deps.length - 1];
const module = compilation.moduleGraph.getModule(dep);
const connections = compilation.moduleGraph.getOutgoingConnections(module);
// visit modules in connections
} |
Beta Was this translation helpful? Give feedback.
if you need some work with ast you need
parser
hooks.you should use module graph for that. something like