Way to retain only whitelisted export names #10152
Unanswered
brijeshb42
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Everyone. I am working on library that uses oxc to parse and replace some of the ast nodes in a code. I had a specific use-case, where I want the code to only retain an export named something specific, for example,
The output I am expecting is -
It removed
React
import as well as the local variablea
since these are not directly/indirectly referred inwhiteListedItem
.It's kind of like tree-shaking but for specific exports. I was going about doing this in one of two ways -
I was trying this method but I got stuck on identifier/symbol tracking. I was able to track the identifiers being used in a specific exports but could not find a way to get the original statement where the symbol is declared. For ex, for the above input code, I get the
colors
's symbol but could not find a way to get to theimport
statement just from the symbol id. Any pointer here might help me make this work as well.Any help or pointer is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions