Create webpack plugin to analyze modules and find import statement #18344
Unanswered
lcskoerner
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been trying to create a plugin to solve the problem below:
Analyze the source code of my application to find for a particular import i.e import useT from './useT';
It should go through the dependency graph as multiple files can import this function
Once the files are found, traverse the AST and look for: const { t } = useT().actions;
Locate all the places where 't' is called and save the arguments in a list (array)
I've been reading the documentation and trying to 'tap' inside of the different steps of the build process but it seems extremely complicated.
I was able to find the dependencies in one of my tries but the raw source code was not available in that part of the process. In other tries, the step was analyzing all deps from node_modules when this is source code from my application and does not come from any npm modules.
I feel so frustrated.
Additionally, there are circular references and the objects (modules) are very large making it very hard to debug.
I appreciate all the help from anyone that already delt with Webpack in the past.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions