Open doc-han opened 1 month ago
Idea 01
I think with static analysis we can just check the children nodes of program
and find an exported function or variable with name getConfig
then remove all other children nodes that aren't that or imports. When it comes to cleaning up imports, how about running eslint --fix
with a single rule remove-ununsed-imports
to avoid walking down the tree.
Final Entirely achievable with static analysis only. ⚡️
Description
Currently, when extracting
getConfig
object from content files. We simulate an environment to execute the file. The issue is that in this same file exists some other JS code that is waiting to be executed on the web. This other code might fail at the stage we're trying to just extract thegetConfig
object.Example getConfig function
What to look for
getConfig
function and its dependency modules so that we don't execute extra code.